twain-1.0.0.0: Tiny web application framework for WAI.
Safe HaskellNone
LanguageHaskell2010

Web.Twain.Types

Synopsis

Documentation

newtype TwainM e a Source #

TwainM provides a monad interface for composing routes and middleware.

Constructors

TwainM (TwainState e -> (a, TwainState e)) 

Instances

Instances details
Monad (TwainM e) Source # 
Instance details

Defined in Web.Twain.Types

Methods

(>>=) :: TwainM e a -> (a -> TwainM e b) -> TwainM e b #

(>>) :: TwainM e a -> TwainM e b -> TwainM e b #

return :: a -> TwainM e a #

Functor (TwainM e) Source # 
Instance details

Defined in Web.Twain.Types

Methods

fmap :: (a -> b) -> TwainM e a -> TwainM e b #

(<$) :: a -> TwainM e b -> TwainM e a #

Applicative (TwainM e) Source # 
Instance details

Defined in Web.Twain.Types

Methods

pure :: a -> TwainM e a #

(<*>) :: TwainM e (a -> b) -> TwainM e a -> TwainM e b #

liftA2 :: (a -> b -> c) -> TwainM e a -> TwainM e b -> TwainM e c #

(*>) :: TwainM e a -> TwainM e b -> TwainM e b #

(<*) :: TwainM e a -> TwainM e b -> TwainM e a #

exec :: TwainM e a -> e -> TwainState e Source #

data RouteM e a Source #

RouteM is a Reader-like monad that can "short-circuit" and return a WAI response using a given environment. This provides convenient branching with do notation for redirects, error responses, etc.

Constructors

RouteM (RouteState e -> IO (Either RouteAction (a, RouteState e))) 

Instances

Instances details
Monad (RouteM e) Source # 
Instance details

Defined in Web.Twain.Types

Methods

(>>=) :: RouteM e a -> (a -> RouteM e b) -> RouteM e b #

(>>) :: RouteM e a -> RouteM e b -> RouteM e b #

return :: a -> RouteM e a #

Functor (RouteM e) Source # 
Instance details

Defined in Web.Twain.Types

Methods

fmap :: (a -> b) -> RouteM e a -> RouteM e b #

(<$) :: a -> RouteM e b -> RouteM e a #

Applicative (RouteM e) Source # 
Instance details

Defined in Web.Twain.Types

Methods

pure :: a -> RouteM e a #

(<*>) :: RouteM e (a -> b) -> RouteM e a -> RouteM e b #

liftA2 :: (a -> b -> c) -> RouteM e a -> RouteM e b -> RouteM e c #

(*>) :: RouteM e a -> RouteM e b -> RouteM e b #

(<*) :: RouteM e a -> RouteM e b -> RouteM e a #

MonadIO (RouteM e) Source # 
Instance details

Defined in Web.Twain.Types

Methods

liftIO :: IO a -> RouteM e a #

type Param = (Text, Text) Source #

data PathPattern Source #

Constructors

MatchPath (Request -> Maybe [Param]) 

Instances

Instances details
IsString PathPattern Source # 
Instance details

Defined in Web.Twain.Types

class ParsableParam a where Source #

Parse values from request parameters.

Minimal complete definition

parseParam

Methods

parseParam :: Text -> Either Text a Source #

parseParamList :: Text -> Either Text [a] Source #

Default implementation parses comma-delimited lists.

Instances

Instances details
ParsableParam Bool Source # 
Instance details

Defined in Web.Twain.Types

ParsableParam Char Source # 
Instance details

Defined in Web.Twain.Types

ParsableParam Double Source # 
Instance details

Defined in Web.Twain.Types

ParsableParam Float Source # 
Instance details

Defined in Web.Twain.Types

ParsableParam Int Source # 
Instance details

Defined in Web.Twain.Types

ParsableParam Int8 Source # 
Instance details

Defined in Web.Twain.Types

ParsableParam Int16 Source # 
Instance details

Defined in Web.Twain.Types

ParsableParam Int32 Source # 
Instance details

Defined in Web.Twain.Types

ParsableParam Int64 Source # 
Instance details

Defined in Web.Twain.Types

ParsableParam Integer Source # 
Instance details

Defined in Web.Twain.Types

ParsableParam Natural Source # 
Instance details

Defined in Web.Twain.Types

ParsableParam Word Source # 
Instance details

Defined in Web.Twain.Types

ParsableParam Word8 Source # 
Instance details

Defined in Web.Twain.Types

ParsableParam Word16 Source # 
Instance details

Defined in Web.Twain.Types

ParsableParam Word32 Source # 
Instance details

Defined in Web.Twain.Types

ParsableParam Word64 Source # 
Instance details

Defined in Web.Twain.Types

ParsableParam () Source # 
Instance details

Defined in Web.Twain.Types

ParsableParam ByteString Source # 
Instance details

Defined in Web.Twain.Types

ParsableParam ByteString Source # 
Instance details

Defined in Web.Twain.Types

ParsableParam Text Source # 
Instance details

Defined in Web.Twain.Types

ParsableParam Text Source # 
Instance details

Defined in Web.Twain.Types

ParsableParam a => ParsableParam [a] Source # 
Instance details

Defined in Web.Twain.Types

readEither :: Read a => Text -> Either Text a Source #

Useful for creating ParsableParam instances for things that already implement Read.