nested-routes-0.3: Declarative, compositional Wai responses

Safe HaskellNone
LanguageHaskell2010

Web.Routes.Nested

Synopsis

Documentation

newtype HandlerT z x m a Source

Constructors

HandlerT 

Fields

runHandler :: WriterT (RUPTrie Text x, RUPTrie Text x) m a
 

Instances

MonadTrans (HandlerT k z x) 
Monad m => Monad (HandlerT k z x m) 
Functor m => Functor (HandlerT k z x m) 
Applicative m => Applicative (HandlerT k z x m) 
MonadIO m => MonadIO (HandlerT k z x m) 

type EitherResponse z m = Either (VerbListenerT z (FileExtListenerT Response m ()) m ()) (VerbListenerT z Response m ()) Source

handleLit Source

Arguments

:: (Monad m, Functor m, cleanxs ~ OnlyJusts xs, HasResult childType (EitherResponse z m), ExpectArity cleanxs childType, Singleton (UrlChunks xs) childType (RUPTrie Text result), Extrude (UrlChunks xs) (RUPTrie Text childType) (RUPTrie Text result), ArityMinusTypeList childType cleanxs ~ result, childType ~ TypeListToArity cleanxs result, LastIsNothing xs) 
=> UrlChunks xs

Path to match against

-> childType

Possibly a function, ending in EitherResponse z m

-> Maybe (HandlerT z childType m ())

Potential child routes

-> HandlerT z result m () 

For routes ending with a literal.

handleParse :: (Monad m, Functor m, cleanxs ~ OnlyJusts xs, HasResult childType (EitherResponse z m), ExpectArity cleanxs childType, Singleton (UrlChunks xs) childType (RUPTrie Text result), Extrude (UrlChunks xs) (RUPTrie Text childType) (RUPTrie Text result), ArityMinusTypeList childType cleanxs ~ result, childType ~ TypeListToArity cleanxs result, LastIsJust xs) => UrlChunks xs -> childType -> Maybe (HandlerT z childType m ()) -> HandlerT z result m () Source

For routes ending with a parser.

notFoundLit :: (Monad m, Functor m, cleanxs ~ OnlyJusts xs, HasResult childType (EitherResponse z m), ExpectArity cleanxs childType, Singleton (UrlChunks xs) childType (RUPTrie Text result), Extrude (UrlChunks xs) (RUPTrie Text childType) (RUPTrie Text result), ArityMinusTypeList childType cleanxs ~ result, childType ~ TypeListToArity cleanxs result, LastIsNothing xs) => UrlChunks xs -> childType -> Maybe (HandlerT z childType m ()) -> HandlerT z result m () Source

notFoundParse :: (Monad m, Functor m, cleanxs ~ OnlyJusts xs, HasResult childType (EitherResponse z m), ExpectArity cleanxs childType, Singleton (UrlChunks xs) childType (RUPTrie Text result), Extrude (UrlChunks xs) (RUPTrie Text childType) (RUPTrie Text result), ArityMinusTypeList childType cleanxs ~ result, childType ~ TypeListToArity cleanxs result, LastIsJust xs) => UrlChunks xs -> childType -> Maybe (HandlerT z childType m ()) -> HandlerT z result m () Source

route Source

Arguments

:: (Functor m, Monad m, MonadIO m) 
=> HandlerT z (EitherResponse z m) m a

Assembled handle calls

-> Request 
-> (Response -> IO ResponseReceived) 
-> m ResponseReceived 

Turns a HandlerT into a Wai Application