Safe Haskell | None |
---|---|
Language | Haskell2010 |
defines the FromBody
typeclass and instances for
- lazy Text
- lazy extracted json
- strict extracted json
- class ReportableError e => FromBody e a | a -> e where
- fromBody :: ByteString -> Either e a
- newtype TextBody = TextBody {
- getTextBody :: Text
- newtype TextBodyS = TextBodyS {
- getTextBodyS :: Text
- newtype Json a = Json {
- getJson :: a
- newtype JsonS a = JsonS {
- getJsonS :: a
Documentation
class ReportableError e => FromBody e a | a -> e where Source
something that can be pulled from the body, restricted to a ReportableError type.
fromBody :: ByteString -> Either e a Source
parse the body. note that the body is provided as a lazy ByteString. how that ByteString is loaded depends on the caller of fromBody.
some instances
text
JSON
newtype for things that should be encoded as or parsed as Json.
the FromBody instance uses eitherDecode
- the lazy version.
FromJSON a => FromBody JsonParseError (Json a) | |
ToJSON a => ToResponseBody (Json a) |
newtype for things that should be encoded as or parsed as Json.
the FromBody
instance uses the immediate eitherDecode'
parser.
FromJSON a => FromBody JsonParseError (JsonS a) | |
ToJSON a => ToResponseBody (JsonS a) |