Safe Haskell | None |
---|---|
Language | Haskell2010 |
A DSL of HTTP-response decoders.
- run :: Response a -> Response BodyReader -> IO (Either Text a)
- data Response a
- headAndBody :: Head a -> Body b -> Response (a, b)
- data Head a
- statusCode :: Matcher Int a -> Head a
- httpVersion :: Matcher (Int, Int) a -> Head a
- headers :: Headers a -> Head a
- data Headers a
- header :: ByteString -> Matcher ByteString a -> Headers a
- contentType :: Matcher ByteString a -> Headers a
- data Body a
- bodyStream :: (IO ByteString -> IO (Either Text a)) -> Body a
- bodyBytes :: Matcher ByteString a -> Body a
- bodyLazyBytes :: Matcher ByteString a -> Body a
- data Matcher a b :: * -> * -> *
- equals :: Eq a => a -> Matcher a ()
- satisfies :: (a -> Bool) -> Matcher a ()
- converts :: (a -> Either Text b) -> Matcher a b
Documentation
Response
headAndBody :: Head a -> Body b -> Response (a, b) Source #
Composes a Response decoder from Head and Body decoders.
You can then merge the tuple in the result using the Functor interface.
Head
Response head decoder.
Supports the Applicative
and Alternative
interfaces.
Headers
Response headers decoder.
header :: ByteString -> Matcher ByteString a -> Headers a Source #
contentType :: Matcher ByteString a -> Headers a Source #
Body
bodyStream :: (IO ByteString -> IO (Either Text a)) -> Body a Source #
bodyLazyBytes :: Matcher ByteString a -> Body a Source #
Matcher
data Matcher a b :: * -> * -> * #
A composable abstraction for checking or converting a context value.