Copyright | (c) Anupam Jain 2013 |
---|---|
License | MIT (see the file LICENSE) |
Maintainer | ajnsit@gmail.com |
Stability | experimental |
Portability | non-portable (uses ghc extensions) |
Safe Haskell | None |
Language | Haskell2010 |
Provides a HandlerM Monad that makes it easy to build Handlers
- type HandlerM sub master a = HandlerMI sub master IO a
- runHandlerM :: HandlerM sub master () -> HandlerS sub master
- request :: HandlerM sub master Request
- routeAttrSet :: RouteAttrs sub => HandlerM sub master (Set Text)
- rootRouteAttrSet :: RouteAttrs master => HandlerM sub master (Set Text)
- maybeRoute :: HandlerM sub master (Maybe (Route sub))
- maybeRootRoute :: HandlerM sub master (Maybe (Route master))
- master :: HandlerM sub master master
- header :: HeaderName -> ByteString -> HandlerM sub master ()
- status :: Status -> HandlerM sub master ()
- raw :: ByteString -> HandlerM sub master ()
- json :: ToJSON a => a -> HandlerM sub master ()
- text :: Text -> HandlerM sub master ()
- html :: ByteString -> HandlerM sub master ()
- next :: HandlerM sub master ()
Documentation
A Monad that makes it easier to build a Handler
runHandlerM :: HandlerM sub master () -> HandlerS sub master Source
Run HandlerM, resulting in a Handler
Run a HandlerM to get a Handler
Access the request data
routeAttrSet :: RouteAttrs sub => HandlerM sub master (Set Text) Source
Get the current route attributes
Access the route attribute list
rootRouteAttrSet :: RouteAttrs master => HandlerM sub master (Set Text) Source
Get the attributes for the current root route
Access the route attribute list for the root route
maybeRoute :: HandlerM sub master (Maybe (Route sub)) Source
Get the current route
Access the route data
maybeRootRoute :: HandlerM sub master (Maybe (Route master)) Source
Get the current root route
Access the root route data
Access the master datatype
header :: HeaderName -> ByteString -> HandlerM sub master () Source
Add a header to the application response TODO: Differentiate between setting and adding headers
Add a header to the response
Set the response status
raw :: ByteString -> HandlerM sub master () Source
Set the response body TODO: Add functions to append to body, and also to flush body contents
Set the raw response body
json :: ToJSON a => a -> HandlerM sub master () Source
Set the body of the response to the JSON encoding of the given value. Also sets "Content-Type" header to "application/json".
Set the json response body
text :: Text -> HandlerM sub master () Source
Set the body of the response to the given Text
value. Also sets "Content-Type"
header to "text/plain".
Set the text response body
html :: ByteString -> HandlerM sub master () Source
Set the body of the response to the given Text
value. Also sets "Content-Type"
header to "text/html".
Set the html response body
Run the next application in the stack