kawhi-0.2.0: stats.NBA.com library

CopyrightAaron Taylor, 2016
LicenseMIT
Maintaineraaron@hamsterdam.co
Safe HaskellNone
LanguageHaskell2010

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

class Monad m => MonadHttp m where Source #

The class of monads capable of HTTP requests.

Minimal complete definition

performRequest

Transformer

newtype HttpT m a Source #

An HTTP transformer monad parameterized by an inner monad m.

Constructors

HttpT 

Instances

MonadTrans HttpT Source # 

Methods

lift :: Monad m => m a -> HttpT m a #

MonadError e m => MonadError e (HttpT m) Source # 

Methods

throwError :: e -> HttpT m a #

catchError :: HttpT m a -> (e -> HttpT m a) -> HttpT m a #

Monad m => Monad (HttpT m) Source # 

Methods

(>>=) :: HttpT m a -> (a -> HttpT m b) -> HttpT m b #

(>>) :: HttpT m a -> HttpT m b -> HttpT m b #

return :: a -> HttpT m a #

fail :: String -> HttpT m a #

Functor m => Functor (HttpT m) Source # 

Methods

fmap :: (a -> b) -> HttpT m a -> HttpT m b #

(<$) :: a -> HttpT m b -> HttpT m a #

Applicative m => Applicative (HttpT m) Source # 

Methods

pure :: a -> HttpT m a #

(<*>) :: HttpT m (a -> b) -> HttpT m a -> HttpT m b #

(*>) :: HttpT m a -> HttpT m b -> HttpT m b #

(<*) :: HttpT m a -> HttpT m b -> HttpT m a #

MonadIO m => MonadIO (HttpT m) Source # 

Methods

liftIO :: IO a -> HttpT m a #

MonadThrow m => MonadThrow (HttpT m) Source # 

Methods

throwM :: Exception e => e -> HttpT m a #

MonadCatch m => MonadCatch (HttpT m) Source # 

Methods

catch :: Exception e => HttpT m a -> (e -> HttpT m a) -> HttpT m a #

MonadThrow m => MonadHttp (HttpT m) Source # 
Monad m => MonadReader (Response ByteString) (HttpT m) Source # 

runHttpT Source #

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.