Safe Haskell | None |
---|---|
Language | Haskell2010 |
The primary Free Monad wrapping HTTP actions.
- type family RequestType client :: *
- type family ResponseType client :: *
- data HttpF client a = HttpF StdMethod (RequestType client) (ResponseType client -> a)
- type FreeHttp client m a = FT (HttpF client) m a
- natHttpF :: (RequestType client1 -> RequestType client2) -> (ResponseType client2 -> ResponseType client1) -> HttpF client1 a -> HttpF client2 a
- transHttp :: Monad m => (RequestType client1 -> RequestType client2) -> (ResponseType client2 -> ResponseType client1) -> FreeHttp client1 m a -> FreeHttp client2 m a
- connect :: Monad m => RequestType client -> FT (HttpF client) m (ResponseType client)
- delete :: Monad m => RequestType client -> FT (HttpF client) m (ResponseType client)
- get :: Monad m => RequestType client -> FT (HttpF client) m (ResponseType client)
- head :: Monad m => RequestType client -> FT (HttpF client) m (ResponseType client)
- options :: Monad m => RequestType client -> FT (HttpF client) m (ResponseType client)
- patch :: Monad m => RequestType client -> FT (HttpF client) m (ResponseType client)
- post :: Monad m => RequestType client -> FT (HttpF client) m (ResponseType client)
- put :: Monad m => RequestType client -> FT (HttpF client) m (ResponseType client)
- trace :: Monad m => RequestType client -> FT (HttpF client) m (ResponseType client)
Type Families
Base Request type
type family RequestType client :: * Source
type family to represent the request type foundation
type RequestType HttpClient = Request Source | HttpClient expects |
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.
Our functor from which the free-http free monad is generated from.
HttpF StdMethod (RequestType client) (ResponseType client -> a) |
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