Safe Haskell | None |
---|---|
Language | Haskell2010 |
- class ToResponse c where
- newtype Json a = Json a
- respond :: ToResponse r => r -> App ()
- respondWith :: ToResponse r => Handler r -> App ()
Documentation
class ToResponse c where Source #
This class represents all types which can be converted into a valid
Response
. Feel free to implement additional instances for your own
data-types.
toResponse :: c -> Response Source #
ToResponse String Source # | |
ToResponse Text Source # | |
ToResponse Value Source # | |
ToResponse Html Source # | |
ToResponse Response Source # | |
ToJSON a => ToResponse (Json a) Source # | |
ToResponse b => ToResponse (b, Status) Source # | |
ToResponse b => ToResponse (b, Status, HeaderMap) Source # | |
A simple newtype wrapper you can use to wrap values, signifying they should be JSON encoded sent with the "application/json" Content-Type.
Json a |
respond :: ToResponse r => r -> App () Source #
Respond to the client immediately. Any statements following this one in the App or Handler Monads will not be run.
respondWith :: ToResponse r => Handler r -> App () Source #
Use a given handler to respond to the request. Any handlers following this will not run.