hreq-client-0.1.0.0: A Type dependent Highlevel HTTP client library.

Safe HaskellNone
LanguageHaskell2010

Hreq.Client.Internal.HTTP

Contents

Description

This module provides functionality for running the Hreq Monad as an HTTP client and the necessary required class instances, such as RunClient instance.

Synopsis

Hreq monad

newtype Hreq m a Source #

Monad for running Http client requests

Constructors

Hreq 

Fields

Instances
MonadTrans Hreq Source # 
Instance details

Defined in Hreq.Client.Internal.HTTP

Methods

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

Monad m => MonadReader HttpConfig (Hreq m) Source # 
Instance details

Defined in Hreq.Client.Internal.HTTP

Methods

ask :: Hreq m HttpConfig #

local :: (HttpConfig -> HttpConfig) -> Hreq m a -> Hreq m a #

reader :: (HttpConfig -> a) -> Hreq m a #

Monad m => Monad (Hreq m) Source # 
Instance details

Defined in Hreq.Client.Internal.HTTP

Methods

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

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

return :: a -> Hreq m a #

fail :: String -> Hreq m a #

Functor m => Functor (Hreq m) Source # 
Instance details

Defined in Hreq.Client.Internal.HTTP

Methods

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

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

Applicative m => Applicative (Hreq m) Source # 
Instance details

Defined in Hreq.Client.Internal.HTTP

Methods

pure :: a -> Hreq m a #

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

liftA2 :: (a -> b -> c) -> Hreq m a -> Hreq m b -> Hreq m c #

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

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

MonadIO m => MonadIO (Hreq m) Source # 
Instance details

Defined in Hreq.Client.Internal.HTTP

Methods

liftIO :: IO a -> Hreq m a #

MonadUnliftIO m => MonadUnliftIO (Hreq m) Source # 
Instance details

Defined in Hreq.Client.Internal.HTTP

Methods

askUnliftIO :: Hreq m (UnliftIO (Hreq m)) #

withRunInIO :: ((forall a. Hreq m a -> IO a) -> IO b) -> Hreq m b #

RunClient (Hreq IO) Source # 
Instance details

Defined in Hreq.Client.Internal.HTTP

Methods

runClient :: Request -> Hreq IO Response #

throwHttpError :: ClientError -> Hreq IO a #

checkResponse :: Request -> Response -> Hreq IO (Maybe ClientError) #

class Monad m => RunClient (m :: Type -> Type) where #

Methods

runClient :: Request -> m Response #

throwHttpError :: ClientError -> m a #

checkResponse :: Request -> Response -> m (Maybe ClientError) #

Instances
RunClient (Hreq IO) Source # 
Instance details

Defined in Hreq.Client.Internal.HTTP

Methods

runClient :: Request -> Hreq IO Response #

throwHttpError :: ClientError -> Hreq IO a #

checkResponse :: Request -> Response -> Hreq IO (Maybe ClientError) #

Running Hreq

runHreq :: MonadIO m => BaseUrl -> Hreq m a -> m a Source #

runHttpClient :: (MonadReader HttpConfig m, MonadIO m, RunClient m) => Request -> m Response Source #

Helper functions

checkHttpResponse :: MonadReader HttpConfig m => Request -> Response -> m (Maybe ClientError) Source #

requestToHTTPRequest :: BaseUrl -> Request -> Request Source #

httpResponsetoResponse :: (a -> b) -> Response a -> ResponseF b Source #

catchConnectionError :: IO a -> IO (Either ClientError a) Source #