| Copyright | Aaron Taylor 2016 |
|---|---|
| License | MIT |
| Maintainer | aaron@hamsterdam.co |
| Safe Haskell | None |
| Language | Haskell2010 |
Control.Monad.Http
Contents
Description
Class, instances and transformer for monads capable of HTTP requests.
In some cases, it is useful to generalize this capability. For example, it can be used provide mock responses for testing.
Synopsis
- class Monad m => MonadHttp m where
- performRequest :: Request -> m (Response ByteString)
- newtype HttpT m a = HttpT {
- unHttpT :: ReaderT (Response ByteString) m a
- runHttpT :: HttpT m a -> Response ByteString -> m a
Class
class Monad m => MonadHttp m where #
The class of monads capable of HTTP requests.
Methods
performRequest :: Request -> m (Response ByteString) #
Instances
| MonadHttp IO # | |
Defined in Control.Monad.Http Methods performRequest :: Request -> IO (Response ByteString) # | |
| MonadThrow m => MonadHttp (HttpT m) # | |
Defined in Control.Monad.Http Methods performRequest :: Request -> HttpT m (Response ByteString) # | |
| MonadIO m => MonadHttp (ExceptT e m) # | |
Defined in Control.Monad.Http Methods performRequest :: Request -> ExceptT e m (Response ByteString) # | |
Transformer
An HTTP transformer monad parameterized by an inner monad m.
Constructors
| HttpT | |
Fields
| |
Instances
| MonadTrans HttpT # | |
Defined in Control.Monad.Http | |
| MonadError e m => MonadError e (HttpT m) # | |
Defined in Control.Monad.Http | |
| Monad m => Monad (HttpT m) # | |
| Functor m => Functor (HttpT m) # | |
| Applicative m => Applicative (HttpT m) # | |
| MonadIO m => MonadIO (HttpT m) # | |
Defined in Control.Monad.Http | |
| MonadThrow m => MonadThrow (HttpT m) # | |
Defined in Control.Monad.Http | |
| MonadCatch m => MonadCatch (HttpT m) # | |
| MonadThrow m => MonadHttp (HttpT m) # | |
Defined in Control.Monad.Http Methods performRequest :: Request -> HttpT m (Response ByteString) # | |
| Monad m => MonadReader (Response ByteString) (HttpT m) # | |
Defined in Control.Monad.Http Methods ask :: HttpT m (Response ByteString) # local :: (Response ByteString -> Response ByteString) -> HttpT m a -> HttpT m a # reader :: (Response ByteString -> a) -> HttpT m a # | |
Arguments
| :: HttpT m a | The HTTP monad transformer |
| -> Response ByteString | The response |
| -> m a | The resulting inner monad |
Run an HTTP monad action and extract the inner monad.