- type Dispatcher a m b = a -> m b -> m b -> m b
- type ListDispatcher a m b = [(a, m b)] -> m b -> m b
- hDispatch :: forall a b c d m. HttpM d m => d -> (Http d :-> b) -> (c -> b -> Bool) -> Dispatcher c m a
- hListDispatch :: Dispatcher a m b -> ListDispatcher a m b
- hRequestDispatch :: HttpM Request m => (Http Request :-> b) -> (t -> b -> Bool) -> Dispatcher t m c
- hResponseDispatch :: HttpM Response m => (Http Response :-> b) -> (t -> b -> Bool) -> Dispatcher t m c
Documentation
type Dispatcher a m b = a -> m b -> m b -> m bSource
type ListDispatcher a m b = [(a, m b)] -> m b -> m bSource
A list dispatcher takes a mapping from dispatch values to handlers and one default fallback handler.
hDispatch :: forall a b c d m. HttpM d m => d -> (Http d :-> b) -> (c -> b -> Bool) -> Dispatcher c m aSource
Dispatch on an arbitrary part of the context using an arbitrary predicate. When
the predicate returns true on the value selected with the Label
the first
handler will be invoked, otherwise the second handler will be used.
hListDispatch :: Dispatcher a m b -> ListDispatcher a m bSource
Turns a dispatcher function into a list dispatcher. This enables handler
routing based on arbitrary values from the context. When non of the predicates
in the ListDispatcher
type hold the default handler will be invoked.
hRequestDispatch :: HttpM Request m => (Http Request :-> b) -> (t -> b -> Bool) -> Dispatcher t m cSource
Like the hDispatch
but always dispatches on a (part of) the `HTTP
Request' part of the context.
hResponseDispatch :: HttpM Response m => (Http Response :-> b) -> (t -> b -> Bool) -> Dispatcher t m cSource
Like the hDispatch
but always dispatches on a (part of) the `HTTP
Response' part of the context.