Copyright | (C) 2015 Futurice Oy |
---|---|
License | BSD-3-Clause |
Maintainer | Oleg Grenrus <oleg.grenrus@iki.fi> |
Safe Haskell | None |
Language | Haskell2010 |
- class Monad m => MonadHttp m where
- withResponse :: Request -> (Response (BodyReaderM m) -> m a) -> m a
- brRead :: BodyReaderM m -> m ByteString
- type BodyReaderM m = m ByteString
- httpLbs :: MonadHttp m => Request -> m (Response ByteString)
- brConsume :: MonadHttp m => BodyReaderM m -> m [ByteString]
Documentation
class Monad m => MonadHttp m where Source
The monad capable to do HTTP requests.
withResponse :: Request -> (Response (BodyReaderM m) -> m a) -> m a Source
Get a single chunk of data from the response body, or an empty bytestring if no more data is available.
Note that in order to consume the entire request body, you will need to
repeatedly call this function until you receive an empty ByteString
as
a result.
brRead :: BodyReaderM m -> m ByteString Source
MonadHttp m => MonadHttp (MaybeT m) Source | |
MonadHttp m => MonadHttp (NoLoggingT m) Source | |
MonadHttp m => MonadHttp (LoggingT m) Source | |
MonadHttp m => MonadHttp (IdentityT m) Source | |
(~) (* -> *) m IO => MonadHttp (HttpT m) Source | TODO: Generalise to MonadIO + MonadMask? |
MonadHttp m => MonadHttp (RandT g m) Source | |
(MonadHttp m, Monoid w) => MonadHttp (WriterT w m) Source | |
(MonadHttp m, Monoid w) => MonadHttp (WriterT w m) Source | |
MonadHttp m => MonadHttp (StateT r m) Source | |
MonadHttp m => MonadHttp (StateT r m) Source | |
MonadHttp m => MonadHttp (ReaderT r m) Source | |
(MonadHttp m, Error e) => MonadHttp (ErrorT e m) Source | |
MonadHttp m => MonadHttp (ExceptT e m) Source | |
MonadHttp m => MonadHttp (CRandT g e m) Source | |
(MonadHttp m, Monoid w) => MonadHttp (RWST r w s m) Source | |
(MonadHttp m, Monoid w) => MonadHttp (RWST r w s m) Source |
type BodyReaderM m = m ByteString Source
httpLbs :: MonadHttp m => Request -> m (Response ByteString) Source
A convenience wrapper around withResponse
which reads in the entire
response body and immediately releases resources.
brConsume :: MonadHttp m => BodyReaderM m -> m [ByteString] Source
Strictly consume all remaining chunks of data from the stream.