free-http-0.2.0: An HTTP Client based on Free Monads.

Safe HaskellNone
LanguageHaskell2010

Network.HTTP.Client.Free

Contents

Description

The primary Free Monad wrapping HTTP actions.

Synopsis

Type Families

Base Request type

type family RequestType client :: * Source

type family to represent the request type foundation

Instances

type RequestType HttpClient = Request Source

HttpClient expects Requests and returns 'Response ByteString's

Base Response type

type family ResponseType client :: * Source

type family to represent the response type foundation

Types

The base functor from which our free monad is generated.

data HttpF client a Source

Our functor from which the free-http free monad is generated from.

Constructors

HttpF StdMethod (RequestType client) (ResponseType client -> a) 

Instances

Functor (HttpF client) Source 

A helpful type alias

type FreeHttp client m a = FT (HttpF client) m a Source

a type alias for the free monad generated by HttpF

Handy morphisms for working with HttpF

natHttpF :: (RequestType client1 -> RequestType client2) -> (ResponseType client2 -> ResponseType client1) -> HttpF client1 a -> HttpF client2 a Source

A natural transformation between HttpF types.

transHttp :: Monad m => (RequestType client1 -> RequestType client2) -> (ResponseType client2 -> ResponseType client1) -> FreeHttp client1 m a -> FreeHttp client2 m a Source

transHttp allows clients to mix-and-match http request and response foundations, so long as there is an appropriate morphism.

smart constructors for http verbs

connect :: Monad m => RequestType client -> FT (HttpF client) m (ResponseType client) Source

delete :: Monad m => RequestType client -> FT (HttpF client) m (ResponseType client) Source

get :: Monad m => RequestType client -> FT (HttpF client) m (ResponseType client) Source

head :: Monad m => RequestType client -> FT (HttpF client) m (ResponseType client) Source

options :: Monad m => RequestType client -> FT (HttpF client) m (ResponseType client) Source

patch :: Monad m => RequestType client -> FT (HttpF client) m (ResponseType client) Source

post :: Monad m => RequestType client -> FT (HttpF client) m (ResponseType client) Source

put :: Monad m => RequestType client -> FT (HttpF client) m (ResponseType client) Source

trace :: Monad m => RequestType client -> FT (HttpF client) m (ResponseType client) Source