| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Network.Api.Support.Response
- type Responder a = Request -> Response ByteString -> a
- data JsonResult a
- = ParseError Text
- | DecodeError Text
- | JsonSuccess a
- parseBody :: FromJSON a => ByteString -> JsonResult a
- parseBodyWith :: FromJSON a => ByteString -> (Text -> b) -> (Text -> b) -> (a -> b) -> b
- basicResponder :: (Int -> ByteString -> a) -> Responder a
Documentation
type Responder a = Request -> Response ByteString -> a Source
Response handler.
data JsonResult a Source
Wrap up json parse and decode errors.
Constructors
| ParseError Text | |
| DecodeError Text | |
| JsonSuccess a |
Instances
| Monad JsonResult | |
| Functor JsonResult | |
| Applicative JsonResult | |
| Eq a => Eq (JsonResult a) | |
| Show a => Show (JsonResult a) |
parseBody :: FromJSON a => ByteString -> JsonResult a Source
Parse and decode body.
parseBodyWith :: FromJSON a => ByteString -> (Text -> b) -> (Text -> b) -> (a -> b) -> b Source
Parse and decode body handling error cases and success case.
basicResponder :: (Int -> ByteString -> a) -> Responder a Source
Lift function handling status code and body into a responder.