Copyright | (C) 2015 Futurice Oy |
---|---|
License | BSD-3-Clause |
Maintainer | Oleg Grenrus <oleg.grenrus@iki.fi> |
Safe Haskell | None |
Language | Haskell2010 |
Control.Monad.Http.Class
Description
- class Monad m => MonadHttp m where
- 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 #
The monad capable to do HTTP requests.
Minimal complete definition
Methods
withResponse :: Request -> (Response (BodyReaderM m) -> m a) -> m a #
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 #
Instances
MonadHttp m => MonadHttp (MaybeT m) # | |
MonadHttp m => MonadHttp (NoLoggingT m) # | |
MonadHttp m => MonadHttp (LoggingT m) # | |
(~) (* -> *) m IO => MonadHttp (HttpT m) # | TODO: Generalise to MonadIO + MonadMask? |
MonadHttp m => MonadHttp (RandT g m) # | |
(MonadHttp m, Monoid w) => MonadHttp (WriterT w m) # | |
(MonadHttp m, Monoid w) => MonadHttp (WriterT w m) # | |
MonadHttp m => MonadHttp (StateT r m) # | |
MonadHttp m => MonadHttp (StateT r m) # | |
(MonadHttp m, Error e) => MonadHttp (ErrorT e m) # | |
MonadHttp m => MonadHttp (ExceptT e m) # | |
MonadHttp m => MonadHttp (IdentityT * m) # | |
MonadHttp m => MonadHttp (ReaderT * r m) # | |
MonadHttp m => MonadHttp (CRandT g e m) # | |
(MonadHttp m, Monoid w) => MonadHttp (RWST r w s m) # | |
(MonadHttp m, Monoid w) => MonadHttp (RWST r w s m) # | |
type BodyReaderM m = m ByteString #
httpLbs :: MonadHttp m => Request -> m (Response ByteString) #
A convenience wrapper around withResponse
which reads in the entire
response body and immediately releases resources.
brConsume :: MonadHttp m => BodyReaderM m -> m [ByteString] #
Strictly consume all remaining chunks of data from the stream.