magicbane-0.4.0: A web framework that integrates Servant, RIO, EKG, fast-logger, wai-cli…

Safe HaskellTrustworthy
LanguageHaskell2010

Magicbane.HTTPClient

Description

Provides an HTTP(S) client via http-client(-tls) in a Magicbane app context. Also provides a simple composable interface for making arbitrary requests, based on http-client-conduit. That lets you plug stream parsers (e.g. html-conduit: 'performWithFn (.| sinkDoc)') directly into the reading of the response body.

Synopsis

Documentation

runHTTP :: ExceptT ε μ α -> μ (Either ε α) Source #

reqU :: MonadHTTP ψ μ => URI -> ExceptT Text μ Request Source #

Creates a request from a URI.

reqS :: (MonadHTTP ψ μ, ConvertibleStrings σ String) => σ -> ExceptT Text μ Request Source #

Creates a request from a string of any type, parsing it into a URI.

anyStatus :: MonadHTTP ψ μ => Request -> ExceptT Text μ Request Source #

Configures the request to not throw errors on error status codes.

postForm :: MonadHTTP ψ μ => [(Text, Text)] -> Request -> ExceptT Text μ Request Source #

Sets a x-www-form-urlencoded form as the request body (also sets the content-type).

postJson :: (MonadHTTP ψ μ, ToJSON α) => α -> Request -> ExceptT Text μ Request Source #

Sets a JSON value as the request body (via ToJSON; also sets the content-type).

performWithFn :: (MonadHTTP ψ μ, MonadCatch μ) => (ConduitM ι ByteString μ () -> ConduitT () Void μ ρ) -> Request -> ExceptT Text μ (Response ρ) Source #

Performs the request, using a given function to read the body. This is what all other performWith functions are based on.

performWithVoid :: (MonadHTTP ψ μ, MonadCatch μ) => Request -> ExceptT Text μ (Response ()) Source #

Performs the request, ignoring the body.

performWithBytes :: (MonadHTTP ψ μ, MonadCatch μ) => Request -> ExceptT Text μ (Response ByteString) Source #

Performs the request, reading the body into a lazy ByteString.

applyHeaders :: RequestHeaders -> Request -> Request Source #

Add headers to the request, preserving any existing headers not specified in the new set.

removeHeaders :: [HeaderName] -> Request -> Request Source #

Remove listed headers from the request.

newtype ExceptT e (m :: * -> *) a #

A monad transformer that adds exceptions to other monads.

ExceptT constructs a monad parameterized over two things:

  • e - The exception type.
  • m - The inner monad.

The return function yields a computation that produces the given value, while >>= sequences two subcomputations, exiting on the first exception.

Constructors

ExceptT (m (Either e a)) 
Instances
MonadReader r m => MonadReader r (ExceptT e m)

Since: mtl-2.2

Instance details

Defined in Control.Monad.Reader.Class

Methods

ask :: ExceptT e m r #

local :: (r -> r) -> ExceptT e m a -> ExceptT e m a #

reader :: (r -> a) -> ExceptT e m a #

MonadBaseControl b m => MonadBaseControl b (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Control

Associated Types

type StM (ExceptT e m) a :: * #

Methods

liftBaseWith :: (RunInBase (ExceptT e m) b -> b a) -> ExceptT e m a #

restoreM :: StM (ExceptT e m) a -> ExceptT e m a #

Monad m => MonadError e (ExceptT e m)

Since: mtl-2.2

Instance details

Defined in Control.Monad.Error.Class

Methods

throwError :: e -> ExceptT e m a #

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

MonadTrans (ExceptT e) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

lift :: Monad m => m a -> ExceptT e m a #

MonadTransControl (ExceptT e) 
Instance details

Defined in Control.Monad.Trans.Control

Associated Types

type StT (ExceptT e) a :: * #

Methods

liftWith :: Monad m => (Run (ExceptT e) -> m a) -> ExceptT e m a #

restoreT :: Monad m => m (StT (ExceptT e) a) -> ExceptT e m a #

Monad m => Monad (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

(>>=) :: ExceptT e m a -> (a -> ExceptT e m b) -> ExceptT e m b #

(>>) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m b #

return :: a -> ExceptT e m a #

fail :: String -> ExceptT e m a #

Functor m => Functor (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

fmap :: (a -> b) -> ExceptT e m a -> ExceptT e m b #

(<$) :: a -> ExceptT e m b -> ExceptT e m a #

MonadFix m => MonadFix (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

mfix :: (a -> ExceptT e m a) -> ExceptT e m a #

MonadFail m => MonadFail (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

fail :: String -> ExceptT e m a #

(Functor m, Monad m) => Applicative (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

pure :: a -> ExceptT e m a #

(<*>) :: ExceptT e m (a -> b) -> ExceptT e m a -> ExceptT e m b #

liftA2 :: (a -> b -> c) -> ExceptT e m a -> ExceptT e m b -> ExceptT e m c #

(*>) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m b #

(<*) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m a #

Foldable f => Foldable (ExceptT e f) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

fold :: Monoid m => ExceptT e f m -> m #

foldMap :: Monoid m => (a -> m) -> ExceptT e f a -> m #

foldr :: (a -> b -> b) -> b -> ExceptT e f a -> b #

foldr' :: (a -> b -> b) -> b -> ExceptT e f a -> b #

foldl :: (b -> a -> b) -> b -> ExceptT e f a -> b #

foldl' :: (b -> a -> b) -> b -> ExceptT e f a -> b #

foldr1 :: (a -> a -> a) -> ExceptT e f a -> a #

foldl1 :: (a -> a -> a) -> ExceptT e f a -> a #

toList :: ExceptT e f a -> [a] #

null :: ExceptT e f a -> Bool #

length :: ExceptT e f a -> Int #

elem :: Eq a => a -> ExceptT e f a -> Bool #

maximum :: Ord a => ExceptT e f a -> a #

minimum :: Ord a => ExceptT e f a -> a #

sum :: Num a => ExceptT e f a -> a #

product :: Num a => ExceptT e f a -> a #

Traversable f => Traversable (ExceptT e f) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

traverse :: Applicative f0 => (a -> f0 b) -> ExceptT e f a -> f0 (ExceptT e f b) #

sequenceA :: Applicative f0 => ExceptT e f (f0 a) -> f0 (ExceptT e f a) #

mapM :: Monad m => (a -> m b) -> ExceptT e f a -> m (ExceptT e f b) #

sequence :: Monad m => ExceptT e f (m a) -> m (ExceptT e f a) #

(Functor m, Monad m, Monoid e) => Alternative (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

empty :: ExceptT e m a #

(<|>) :: ExceptT e m a -> ExceptT e m a -> ExceptT e m a #

some :: ExceptT e m a -> ExceptT e m [a] #

many :: ExceptT e m a -> ExceptT e m [a] #

(Monad m, Monoid e) => MonadPlus (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

mzero :: ExceptT e m a #

mplus :: ExceptT e m a -> ExceptT e m a -> ExceptT e m a #

(Eq e, Eq1 m) => Eq1 (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftEq :: (a -> b -> Bool) -> ExceptT e m a -> ExceptT e m b -> Bool #

(Ord e, Ord1 m) => Ord1 (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftCompare :: (a -> b -> Ordering) -> ExceptT e m a -> ExceptT e m b -> Ordering #

(Read e, Read1 m) => Read1 (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (ExceptT e m a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [ExceptT e m a] #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (ExceptT e m a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [ExceptT e m a] #

(Show e, Show1 m) => Show1 (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> ExceptT e m a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [ExceptT e m a] -> ShowS #

MonadZip m => MonadZip (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

mzip :: ExceptT e m a -> ExceptT e m b -> ExceptT e m (a, b) #

mzipWith :: (a -> b -> c) -> ExceptT e m a -> ExceptT e m b -> ExceptT e m c #

munzip :: ExceptT e m (a, b) -> (ExceptT e m a, ExceptT e m b) #

MonadIO m => MonadIO (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftIO :: IO a -> ExceptT e m a #

MonadResource m => MonadResource (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> ExceptT e m a #

PrimMonad m => PrimMonad (ExceptT e m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ExceptT e m) :: * #

Methods

primitive :: (State# (PrimState (ExceptT e m)) -> (#State# (PrimState (ExceptT e m)), a#)) -> ExceptT e m a #

MonadThrow m => MonadThrow (ExceptT e m)

Throws exceptions into the base monad.

Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e0 => e0 -> ExceptT e m a #

MonadCatch m => MonadCatch (ExceptT e m)

Catches exceptions from the base monad.

Instance details

Defined in Control.Monad.Catch

Methods

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

MonadMask m => MonadMask (ExceptT e m)

Since: exceptions-0.9.0

Instance details

Defined in Control.Monad.Catch

Methods

mask :: ((forall a. ExceptT e m a -> ExceptT e m a) -> ExceptT e m b) -> ExceptT e m b #

uninterruptibleMask :: ((forall a. ExceptT e m a -> ExceptT e m a) -> ExceptT e m b) -> ExceptT e m b #

generalBracket :: ExceptT e m a -> (a -> ExitCase b -> ExceptT e m c) -> (a -> ExceptT e m b) -> ExceptT e m (b, c) #

MonadLogger m => MonadLogger (ExceptT e m) 
Instance details

Defined in Control.Monad.Logger

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> ExceptT e m () #

MonadLoggerIO m => MonadLoggerIO (ExceptT e m) 
Instance details

Defined in Control.Monad.Logger

Methods

askLoggerIO :: ExceptT e m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) #

(Eq e, Eq1 m, Eq a) => Eq (ExceptT e m a) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

(==) :: ExceptT e m a -> ExceptT e m a -> Bool #

(/=) :: ExceptT e m a -> ExceptT e m a -> Bool #

(Ord e, Ord1 m, Ord a) => Ord (ExceptT e m a) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

compare :: ExceptT e m a -> ExceptT e m a -> Ordering #

(<) :: ExceptT e m a -> ExceptT e m a -> Bool #

(<=) :: ExceptT e m a -> ExceptT e m a -> Bool #

(>) :: ExceptT e m a -> ExceptT e m a -> Bool #

(>=) :: ExceptT e m a -> ExceptT e m a -> Bool #

max :: ExceptT e m a -> ExceptT e m a -> ExceptT e m a #

min :: ExceptT e m a -> ExceptT e m a -> ExceptT e m a #

(Read e, Read1 m, Read a) => Read (ExceptT e m a) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

readsPrec :: Int -> ReadS (ExceptT e m a) #

readList :: ReadS [ExceptT e m a] #

readPrec :: ReadPrec (ExceptT e m a) #

readListPrec :: ReadPrec [ExceptT e m a] #

(Show e, Show1 m, Show a) => Show (ExceptT e m a) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

showsPrec :: Int -> ExceptT e m a -> ShowS #

show :: ExceptT e m a -> String #

showList :: [ExceptT e m a] -> ShowS #

type StT (ExceptT e) a 
Instance details

Defined in Control.Monad.Trans.Control

type StT (ExceptT e) a = Either e a
type PrimState (ExceptT e m) 
Instance details

Defined in Control.Monad.Primitive

type PrimState (ExceptT e m) = PrimState m
type StM (ExceptT e m) a 
Instance details

Defined in Control.Monad.Trans.Control

type StM (ExceptT e m) a = ComposeSt (ExceptT e) m a

class MonadIO m => MonadUnliftIO (m :: * -> *) #

Monads which allow their actions to be run in IO.

While MonadIO allows an IO action to be lifted into another monad, this class captures the opposite concept: allowing you to capture the monadic context. Note that, in order to meet the laws given below, the intuition is that a monad must have no monadic state, but may have monadic context. This essentially limits MonadUnliftIO to ReaderT and IdentityT transformers on top of IO.

Laws. For any value u returned by askUnliftIO, it must meet the monad transformer laws as reformulated for MonadUnliftIO:

  • unliftIO u . return = return
  • unliftIO u (m >>= f) = unliftIO u m >>= unliftIO u . f

The third is a currently nameless law which ensures that the current context is preserved.

  • askUnliftIO >>= (u -> liftIO (unliftIO u m)) = m

If you have a name for this, please submit it in a pull request for great glory.

Since: unliftio-core-0.1.0.0

Minimal complete definition

askUnliftIO | withRunInIO

Instances
MonadUnliftIO IO 
Instance details

Defined in Control.Monad.IO.Unlift

Methods

askUnliftIO :: IO (UnliftIO IO) #

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

MonadUnliftIO m => MonadUnliftIO (ResourceT m)

Since: resourcet-1.1.10

Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

askUnliftIO :: ResourceT m (UnliftIO (ResourceT m)) #

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

MonadUnliftIO m => MonadUnliftIO (NoLoggingT m)

Since: monad-logger-0.3.26

Instance details

Defined in Control.Monad.Logger

Methods

askUnliftIO :: NoLoggingT m (UnliftIO (NoLoggingT m)) #

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

MonadUnliftIO m => MonadUnliftIO (LoggingT m)

Since: monad-logger-0.3.26

Instance details

Defined in Control.Monad.Logger

Methods

askUnliftIO :: LoggingT m (UnliftIO (LoggingT m)) #

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

MonadUnliftIO (RIO env) 
Instance details

Defined in RIO.Prelude.RIO

Methods

askUnliftIO :: RIO env (UnliftIO (RIO env)) #

withRunInIO :: ((forall a. RIO env a -> IO a) -> IO b) -> RIO env b #

MonadUnliftIO m => MonadUnliftIO (IdentityT m) 
Instance details

Defined in Control.Monad.IO.Unlift

Methods

askUnliftIO :: IdentityT m (UnliftIO (IdentityT m)) #

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

MonadUnliftIO m => MonadUnliftIO (ReaderT r m) 
Instance details

Defined in Control.Monad.IO.Unlift

Methods

askUnliftIO :: ReaderT r m (UnliftIO (ReaderT r m)) #

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

runExceptT :: ExceptT e m a -> m (Either e a) #

The inverse of ExceptT.

class MonadThrow m => MonadCatch (m :: * -> *) #

A class for monads which allow exceptions to be caught, in particular exceptions which were thrown by throwM.

Instances should obey the following law:

catch (throwM e) f = f e

Note that the ability to catch an exception does not guarantee that we can deal with all possible exit points from a computation. Some monads, such as continuation-based stacks, allow for more than just a success/failure strategy, and therefore catch cannot be used by those monads to properly implement a function such as finally. For more information, see MonadMask.

Minimal complete definition

catch

Instances
MonadCatch IO 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => IO a -> (e -> IO a) -> IO a #

MonadCatch STM 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => STM a -> (e -> STM a) -> STM a #

MonadCatch Handler 
Instance details

Defined in Servant.Server.Internal.Handler

Methods

catch :: Exception e => Handler a -> (e -> Handler a) -> Handler a #

e ~ SomeException => MonadCatch (Either e)

Since: exceptions-0.8.3

Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e0 => Either e a -> (e0 -> Either e a) -> Either e a #

MonadCatch m => MonadCatch (MaybeT m)

Catches exceptions from the base monad.

Instance details

Defined in Control.Monad.Catch

Methods

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

MonadCatch m => MonadCatch (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

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

MonadCatch m => MonadCatch (ListT m) 
Instance details

Defined in Control.Monad.Catch

Methods

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

MonadCatch m => MonadCatch (NoLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadCatch m => MonadCatch (WriterLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadCatch m => MonadCatch (LoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadCatch m => MonadCatch (IdentityT m) 
Instance details

Defined in Control.Monad.Catch

Methods

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

(MonadCatch m, Monoid w) => MonadCatch (WriterT w m) 
Instance details

Defined in Control.Monad.Catch

Methods

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

(MonadCatch m, Monoid w) => MonadCatch (WriterT w m) 
Instance details

Defined in Control.Monad.Catch

Methods

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

MonadCatch m => MonadCatch (StateT s m) 
Instance details

Defined in Control.Monad.Catch

Methods

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

MonadCatch m => MonadCatch (StateT s m) 
Instance details

Defined in Control.Monad.Catch

Methods

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

MonadCatch m => MonadCatch (ExceptT e m)

Catches exceptions from the base monad.

Instance details

Defined in Control.Monad.Catch

Methods

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

(Error e, MonadCatch m) => MonadCatch (ErrorT e m)

Catches exceptions from the base monad.

Instance details

Defined in Control.Monad.Catch

Methods

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

MonadCatch m => MonadCatch (ReaderT r m) 
Instance details

Defined in Control.Monad.Catch

Methods

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

(MonadCatch m, Monoid w) => MonadCatch (RWST r w s m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => RWST r w s m a -> (e -> RWST r w s m a) -> RWST r w s m a #

(MonadCatch m, Monoid w) => MonadCatch (RWST r w s m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => RWST r w s m a -> (e -> RWST r w s m a) -> RWST r w s m a #

data URI #

Represents a general universal resource identifier using its component parts.

For example, for the URI

  foo://anonymous@www.haskell.org:42/ghc?query#frag

the components are:

Constructors

URI 

Fields

Instances
Eq URI 
Instance details

Defined in Network.URI

Methods

(==) :: URI -> URI -> Bool #

(/=) :: URI -> URI -> Bool #

Data URI 
Instance details

Defined in Network.URI

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> URI -> c URI #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c URI #

toConstr :: URI -> Constr #

dataTypeOf :: URI -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c URI) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c URI) #

gmapT :: (forall b. Data b => b -> b) -> URI -> URI #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> URI -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> URI -> r #

gmapQ :: (forall d. Data d => d -> u) -> URI -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> URI -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> URI -> m URI #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> URI -> m URI #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> URI -> m URI #

Ord URI 
Instance details

Defined in Network.URI

Methods

compare :: URI -> URI -> Ordering #

(<) :: URI -> URI -> Bool #

(<=) :: URI -> URI -> Bool #

(>) :: URI -> URI -> Bool #

(>=) :: URI -> URI -> Bool #

max :: URI -> URI -> URI #

min :: URI -> URI -> URI #

Show URI 
Instance details

Defined in Network.URI

Methods

showsPrec :: Int -> URI -> ShowS #

show :: URI -> String #

showList :: [URI] -> ShowS #

Generic URI 
Instance details

Defined in Network.URI

Associated Types

type Rep URI :: * -> * #

Methods

from :: URI -> Rep URI x #

to :: Rep URI x -> URI #

NFData URI 
Instance details

Defined in Network.URI

Methods

rnf :: URI -> () #

type Rep URI 
Instance details

Defined in Network.URI

responseTimeoutDefault :: ResponseTimeout #

Use the default response timeout

When used on a Request, means: use the manager's timeout value

When used on a ManagerSettings, means: default to 30 seconds

Since: http-client-0.5.0

responseTimeoutNone :: ResponseTimeout #

Do not have a response timeout

Since: http-client-0.5.0

responseTimeoutMicro :: Int -> ResponseTimeout #

Specify a response timeout in microseconds

Since: http-client-0.5.0

managerSetProxy :: ProxyOverride -> ManagerSettings -> ManagerSettings #

Set the proxy override value, for both HTTP (insecure) and HTTPS (insecure) connections.

Since 0.4.7

managerSetSecureProxy :: ProxyOverride -> ManagerSettings -> ManagerSettings #

Set the proxy override value, only for HTTPS (secure) connections.

Since 0.4.7

managerSetInsecureProxy :: ProxyOverride -> ManagerSettings -> ManagerSettings #

Set the proxy override value, only for HTTP (insecure) connections.

Since 0.4.7

withResponseHistory :: Request -> Manager -> (HistoriedResponse BodyReader -> IO a) -> IO a #

A variant of withResponse which keeps a history of all redirects performed in the interim, together with the first 1024 bytes of their response bodies.

Since 0.4.1

responseOpenHistory :: Request -> Manager -> IO (HistoriedResponse BodyReader) #

A variant of responseOpen which keeps a history of all redirects performed in the interim, together with the first 1024 bytes of their response bodies.

Since 0.4.1

data HistoriedResponse body #

A datatype holding information on redirected requests and the final response.

Since 0.4.1

Instances
Functor HistoriedResponse 
Instance details

Defined in Network.HTTP.Client

Foldable HistoriedResponse 
Instance details

Defined in Network.HTTP.Client

Methods

fold :: Monoid m => HistoriedResponse m -> m #

foldMap :: Monoid m => (a -> m) -> HistoriedResponse a -> m #

foldr :: (a -> b -> b) -> b -> HistoriedResponse a -> b #

foldr' :: (a -> b -> b) -> b -> HistoriedResponse a -> b #

foldl :: (b -> a -> b) -> b -> HistoriedResponse a -> b #

foldl' :: (b -> a -> b) -> b -> HistoriedResponse a -> b #

foldr1 :: (a -> a -> a) -> HistoriedResponse a -> a #

foldl1 :: (a -> a -> a) -> HistoriedResponse a -> a #

toList :: HistoriedResponse a -> [a] #

null :: HistoriedResponse a -> Bool #

length :: HistoriedResponse a -> Int #

elem :: Eq a => a -> HistoriedResponse a -> Bool #

maximum :: Ord a => HistoriedResponse a -> a #

minimum :: Ord a => HistoriedResponse a -> a #

sum :: Num a => HistoriedResponse a -> a #

product :: Num a => HistoriedResponse a -> a #

Traversable HistoriedResponse 
Instance details

Defined in Network.HTTP.Client

Methods

traverse :: Applicative f => (a -> f b) -> HistoriedResponse a -> f (HistoriedResponse b) #

sequenceA :: Applicative f => HistoriedResponse (f a) -> f (HistoriedResponse a) #

mapM :: Monad m => (a -> m b) -> HistoriedResponse a -> m (HistoriedResponse b) #

sequence :: Monad m => HistoriedResponse (m a) -> m (HistoriedResponse a) #

Show body => Show (HistoriedResponse body) 
Instance details

Defined in Network.HTTP.Client

Generic (HistoriedResponse body) 
Instance details

Defined in Network.HTTP.Client

Associated Types

type Rep (HistoriedResponse body) :: * -> * #

Methods

from :: HistoriedResponse body -> Rep (HistoriedResponse body) x #

to :: Rep (HistoriedResponse body) x -> HistoriedResponse body #

type Rep (HistoriedResponse body) 
Instance details

Defined in Network.HTTP.Client

type Rep (HistoriedResponse body) = D1 (MetaData "HistoriedResponse" "Network.HTTP.Client" "http-client-0.5.13.1-JQVmW3vQYAt5e1zBJeeP10" False) (C1 (MetaCons "HistoriedResponse" PrefixI True) (S1 (MetaSel (Just "hrRedirects") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(Request, Response ByteString)]) :*: (S1 (MetaSel (Just "hrFinalRequest") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Request) :*: S1 (MetaSel (Just "hrFinalResponse") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Response body)))))

withConnection :: Request -> Manager -> (Connection -> IO a) -> IO a #

Perform an action using a Connection acquired from the given Manager.

You should use this only when you have to read and write interactively through the connection (e.g. connection by the WebSocket protocol).

Since: http-client-0.5.13

responseClose :: Response a -> IO () #

Close any open resources associated with the given Response. In general, this will either close an active Connection or return it to the Manager to be reused.

Since 0.1.0

responseOpen :: Request -> Manager -> IO (Response BodyReader) #

The most low-level function for initiating an HTTP request.

The first argument to this function gives a full specification on the request: the host to connect to, whether to use SSL, headers, etc. Please see Request for full details. The second argument specifies which Manager should be used.

This function then returns a Response with a BodyReader. The Response contains the status code and headers that were sent back to us, and the BodyReader contains the body of the request. Note that this BodyReader allows you to have fully interleaved IO actions during your HTTP download, making it possible to download very large responses in constant memory.

An important note: the response body returned by this function represents a live HTTP connection. As such, if you do not use the response body, an open socket will be retained indefinitely. You must be certain to call responseClose on this response to free up resources.

This function automatically performs any necessary redirects, as specified by the redirectCount setting.

When implementing a (reverse) proxy using this function or relating functions, it's wise to remove Transfer-Encoding:, Content-Length:, Content-Encoding: and Accept-Encoding: from request and response headers to be relayed.

Since 0.1.0

httpNoBody :: Request -> Manager -> IO (Response ()) #

A convenient wrapper around withResponse which ignores the response body. This is useful, for example, when performing a HEAD request.

Since 0.3.2

httpLbs :: Request -> Manager -> IO (Response ByteString) #

A convenience wrapper around withResponse which reads in the entire response body and immediately closes the connection. Note that this function performs fully strict I/O, and only uses a lazy ByteString in its response for memory efficiency. If you are anticipating a large response body, you are encouraged to use withResponse and brRead instead.

Since 0.1.0

withResponse :: Request -> Manager -> (Response BodyReader -> IO a) -> IO a #

Perform a Request using a connection acquired from the given Manager, and then provide the Response to the given function. This function is fully exception safe, guaranteeing that the response will be closed when the inner function exits. It is defined as:

withResponse req man f = bracket (responseOpen req man) responseClose f

It is recommended that you use this function in place of explicit calls to responseOpen and responseClose.

You will need to use functions such as brRead to consume the response body.

Since 0.1.0

generateCookie #

Arguments

:: SetCookie

The SetCookie we are encountering

-> Request

The request that originated the response that yielded the SetCookie

-> UTCTime

Value that should be used as "now"

-> Bool

Whether or not this request is coming from an "http" source (not javascript or anything like that)

-> Maybe Cookie

The optional output cookie

Turn a SetCookie into a Cookie, if it is valid

insertCheckedCookie #

Arguments

:: Cookie

The SetCookie the cookie jar is receiving

-> CookieJar

Input cookie jar to modify

-> Bool

Whether or not this request is coming from an "http" source (not javascript or anything like that)

-> CookieJar

Updated (or not) cookie jar

Insert a cookie created by generateCookie into the cookie jar (or not if it shouldn't be allowed in)

receiveSetCookie #

Arguments

:: SetCookie

The SetCookie the cookie jar is receiving

-> Request

The request that originated the response that yielded the SetCookie

-> UTCTime

Value that should be used as "now"

-> Bool

Whether or not this request is coming from an "http" source (not javascript or anything like that)

-> CookieJar

Input cookie jar to modify

-> CookieJar

Updated cookie jar

This corresponds to the algorithm described in Section 5.3 "Storage Model" This function consists of calling generateCookie followed by insertCheckedCookie. Use this function if you plan to do both in a row. generateCookie and insertCheckedCookie are only provided for more fine-grained control.

updateCookieJar #

Arguments

:: Response a

Response received from server

-> Request

Request which generated the response

-> UTCTime

Value that should be used as "now"

-> CookieJar

Current cookie jar

-> (CookieJar, Response a)

(Updated cookie jar with cookies from the Response, The response stripped of any "Set-Cookie" header)

This applies receiveSetCookie to a given Response

computeCookieString #

Arguments

:: Request

Input request

-> CookieJar

Current cookie jar

-> UTCTime

Value that should be used as "now"

-> Bool

Whether or not this request is coming from an "http" source (not javascript or anything like that)

-> (ByteString, CookieJar)

(Contents of a "Cookie" header, Updated cookie jar (last-access-time is updated))

This corresponds to the algorithm described in Section 5.4 "The Cookie Header"

insertCookiesIntoRequest #

Arguments

:: Request

The request to insert into

-> CookieJar

Current cookie jar

-> UTCTime

Value that should be used as "now"

-> (Request, CookieJar)

(Output request, Updated cookie jar (last-access-time is updated))

This applies the computeCookieString to a given Request

evictExpiredCookies #

Arguments

:: CookieJar

Input cookie jar

-> UTCTime

Value that should be used as "now"

-> CookieJar

Filtered cookie jar

This corresponds to the eviction algorithm described in Section 5.3 "Storage Model"

pathMatches :: ByteString -> ByteString -> Bool #

This corresponds to the subcomponent algorithm entitled "Path-Match" detailed in section 5.1.4

defaultPath :: Request -> ByteString #

This corresponds to the subcomponent algorithm entitled "Paths" detailed in section 5.1.4

domainMatches #

Arguments

:: ByteString

Domain to test

-> ByteString

Domain from a cookie

-> Bool 

This corresponds to the subcomponent algorithm entitled "Domain Matching" detailed in section 5.1.3

defaultProxy :: ProxyOverride #

The default proxy settings for a manager. In particular: if the http_proxy (or https_proxy) environment variable is set, use it. Otherwise, use the values in the Request.

Since 0.4.7

proxyEnvironmentNamed #

Arguments

:: Text

environment variable name

-> Maybe Proxy

fallback if no environment set

-> ProxyOverride 

Same as proxyEnvironment, but instead of default environment variable names, allows you to set your own name.

Since 0.4.7

proxyEnvironment #

Arguments

:: Maybe Proxy

fallback if no environment set

-> ProxyOverride 

Get the proxy settings from the default environment variable (http_proxy for insecure, https_proxy for secure). If no variable is set, then fall back to the given value. Nothing is equivalent to noProxy, Just is equivalent to useProxy.

Since 0.4.7

useProxy :: Proxy -> ProxyOverride #

Use the given proxy settings, regardless of the proxy value in the Request.

Since 0.4.7

noProxy :: ProxyOverride #

Never connect using a proxy, regardless of the proxy value in the Request.

Since 0.4.7

proxyFromRequest :: ProxyOverride #

Get the proxy settings from the Request itself.

Since 0.4.7

withManager :: ManagerSettings -> (Manager -> IO a) -> IO a #

Create, use and close a Manager.

Since 0.2.1

closeManager :: Manager -> IO () #

Close all connections in a Manager.

Note that this doesn't affect currently in-flight connections, meaning you can safely use it without hurting any queries you may have concurrently running.

Since 0.1.0

newManager :: ManagerSettings -> IO Manager #

Create a Manager. The Manager will be shut down automatically via garbage collection.

Creating a new Manager is a relatively expensive operation, you are advised to share a single Manager between requests instead.

The first argument to this function is often defaultManagerSettings, though add-on libraries may provide a recommended replacement.

Since 0.1.0

defaultManagerSettings :: ManagerSettings #

Default value for ManagerSettings.

Note that this value does not have support for SSL/TLS. If you need to make any https connections, please use the http-client-tls package, which provides a tlsManagerSettings value.

Since 0.1.0

rawConnectionModifySocketSize :: (Socket -> IO ()) -> IO (Int -> Maybe HostAddress -> String -> Int -> IO Connection) #

Same as rawConnectionModifySocket, but also takes in a chunk size.

Since: http-client-0.5.2

rawConnectionModifySocket :: (Socket -> IO ()) -> IO (Maybe HostAddress -> String -> Int -> IO Connection) #

A value for the managerRawConnection setting, but also allows you to modify the underlying Socket to set additional settings. For a motivating use case, see: https://github.com/snoyberg/http-client/issues/71.

Since 0.3.8

observedStreamFile :: (StreamFileStatus -> IO ()) -> FilePath -> IO RequestBody #

Send a file as the request body, while observing streaming progress via a PopObserver. Observations are made between reading and sending a chunk.

It is expected that the file size does not change between calling observedStreamFile and making any requests using this request body.

Since 0.4.9

streamFile :: FilePath -> IO RequestBody #

Send a file as the request body.

It is expected that the file size does not change between calling streamFile and making any requests using this request body.

Since 0.4.9

setQueryStringPartialEscape :: [(ByteString, [EscapeItem])] -> Request -> Request #

Set the query string to the given key/value pairs.

Since: http-client-0.5.10

setQueryString :: [(ByteString, Maybe ByteString)] -> Request -> Request #

Set the query string to the given key/value pairs.

Since 0.3.6

setRequestCheckStatus :: Request -> Request #

Modify the request so that non-2XX status codes generate a runtime StatusCodeException, by using throwErrorStatusCodes

Since: http-client-0.5.13

setRequestIgnoreStatus :: Request -> Request #

Modify the request so that non-2XX status codes do not generate a runtime StatusCodeException.

Since: http-client-0.4.29

urlEncodedBody :: [(ByteString, ByteString)] -> Request -> Request #

Add url-encoded parameters to the Request.

This sets a new requestBody, adds a content-type request header and changes the method to POST.

Since 0.1.0

applyBasicProxyAuth :: ByteString -> ByteString -> Request -> Request #

Add a Proxy-Authorization header (with the specified username and password) to the given Request. Ignore error handling:

applyBasicProxyAuth "user" "pass" <$> parseRequest "http://example.org"

Since 0.3.4

applyBasicAuth :: ByteString -> ByteString -> Request -> Request #

Add a Basic Auth header (with the specified user name and password) to the given Request. Ignore error handling:

 applyBasicAuth "user" "pass" $ parseRequest_ url

NOTE: The function applyDigestAuth is provided by the http-client-tls package instead of this package due to extra dependencies. Please use that package if you need to use digest authentication.

Since 0.1.0

defaultRequest :: Request #

A default request value, a GET request of localhost/:80, with an empty request body.

Note that the default checkResponse does nothing.

Since: http-client-0.4.30

getUri :: Request -> URI #

Extract a URI from the request.

Since 0.1.0

requestFromURI_ :: URI -> Request #

Same as requestFromURI, but if the conversion would fail, throws an impure exception.

Since: http-client-0.5.12

requestFromURI :: MonadThrow m => URI -> m Request #

Convert a URI into a Request.

This can fail if the given URI is not absolute, or if the URI scheme is not "http" or "https". In these cases the function will throw an error via MonadThrow.

This function defaults some of the values in Request, such as setting method to GET and requestHeaders to [].

A Request created by this function won't cause exceptions on non-2XX response status codes.

Since: http-client-0.5.12

parseRequest_ :: String -> Request #

Same as parseRequest, but parse errors cause an impure exception. Mostly useful for static strings which are known to be correctly formatted.

parseRequest :: MonadThrow m => String -> m Request #

Convert a URL into a Request.

This function defaults some of the values in Request, such as setting method to GET and requestHeaders to [].

Since this function uses MonadThrow, the return monad can be anything that is an instance of MonadThrow, such as IO or Maybe.

You can place the request method at the beginning of the URL separated by a space, e.g.:

@@ parseRequest "POST http://httpbin.org/post" @@

Note that the request method must be provided as all capital letters.

A Request created by this function won't cause exceptions on non-2XX response status codes.

To create a request which throws on non-2XX status codes, see parseUrlThrow

Since: http-client-0.4.30

throwErrorStatusCodes :: MonadIO m => Request -> Response BodyReader -> m () #

Throws a StatusCodeException wrapped in HttpExceptionRequest, if the response's status code indicates an error (if it isn't 2xx). This can be used to implement checkResponse.

Since: http-client-0.5.13

parseUrlThrow :: MonadThrow m => String -> m Request #

Same as parseRequest, except will throw an HttpException in the event of a non-2XX response. This uses throwErrorStatusCodes to implement checkResponse.

Since: http-client-0.4.30

parseUrl :: MonadThrow m => String -> m Request #

Deprecated synonym for parseUrlThrow. You probably want parseRequest or parseRequest_ instead.

Since: http-client-0.1.0

brConsume :: BodyReader -> IO [ByteString] #

Strictly consume all remaining chunks of data from the stream.

Since 0.1.0

brReadSome :: BodyReader -> Int -> IO ByteString #

Continuously call brRead, building up a lazy ByteString until a chunk is constructed that is at least as many bytes as requested.

Since 0.4.20

brRead :: BodyReader -> IO ByteString #

Get a single chunk of data from the response body, or an empty bytestring if no more data is available.

Note that in order to consume the entire request body, you will need to repeatedly call this function until you receive an empty ByteString as a result.

Since 0.1.0

socketConnection #

Arguments

:: Socket 
-> Int

chunk size

-> IO Connection 

Create a new Connection from a Socket.

Since: http-client-0.5.3

makeConnection #

Arguments

:: IO ByteString

read

-> (ByteString -> IO ())

write

-> IO ()

close

-> IO Connection 

Create a new Connection from a read, write, and close function.

Since: http-client-0.5.3

type BodyReader = IO ByteString #

An IO action that represents an incoming response body coming from the server. Data provided by this action has already been gunzipped and de-chunked, and respects any content-length headers present.

The action gets a single chunk of data from the response body, or an empty bytestring if no more data is available.

Since 0.4.0

data HttpException #

An exception which may be generated by this library

Since: http-client-0.5.0

Constructors

HttpExceptionRequest Request HttpExceptionContent

Most exceptions are specific to a Request. Inspect the HttpExceptionContent value for details on what occurred.

Since: http-client-0.5.0

InvalidUrlException String String

A URL (first field) is invalid for a given reason (second argument).

Since: http-client-0.5.0

data HttpExceptionContent #

Constructors

StatusCodeException (Response ()) ByteString

Generated by the parseUrlThrow function when the server returns a non-2XX response status code.

May include the beginning of the response body.

Since: http-client-0.5.0

TooManyRedirects [Response ByteString]

The server responded with too many redirects for a request.

Contains the list of encountered responses containing redirects in reverse chronological order; including last redirect, which triggered the exception and was not followed.

Since: http-client-0.5.0

OverlongHeaders

Either too many headers, or too many total bytes in a single header, were returned by the server, and the memory exhaustion protection in this library has kicked in.

Since: http-client-0.5.0

ResponseTimeout

The server took too long to return a response. This can be altered via responseTimeout or managerResponseTimeout.

Since: http-client-0.5.0

ConnectionTimeout

Attempting to connect to the server timed out.

Since: http-client-0.5.0

ConnectionFailure SomeException

An exception occurred when trying to connect to the server.

Since: http-client-0.5.0

InvalidStatusLine ByteString

The status line returned by the server could not be parsed.

Since: http-client-0.5.0

InvalidHeader ByteString

The given response header line could not be parsed

Since: http-client-0.5.0

InternalException SomeException

An exception was raised by an underlying library when performing the request. Most often, this is caused by a failing socket action or a TLS exception.

Since: http-client-0.5.0

ProxyConnectException ByteString Int Status

A non-200 status code was returned when trying to connect to the proxy server on the given host and port.

Since: http-client-0.5.0

NoResponseDataReceived

No response data was received from the server at all. This exception may deserve special handling within the library, since it may indicate that a pipelining has been used, and a connection thought to be open was in fact closed.

Since: http-client-0.5.0

TlsNotSupported

Exception thrown when using a Manager which does not have support for secure connections. Typically, you will want to use tlsManagerSettings from http-client-tls to overcome this.

Since: http-client-0.5.0

WrongRequestBodyStreamSize Word64 Word64

The request body provided did not match the expected size.

Provides the expected and actual size.

Since: http-client-0.4.31

ResponseBodyTooShort Word64 Word64

The returned response body is too short. Provides the expected size and actual size.

Since: http-client-0.5.0

InvalidChunkHeaders

A chunked response body had invalid headers.

Since: http-client-0.5.0

IncompleteHeaders

An incomplete set of response headers were returned.

Since: http-client-0.5.0

InvalidDestinationHost ByteString

The host we tried to connect to is invalid (e.g., an empty string).

HttpZlibException ZlibException

An exception was thrown when inflating a response body.

Since: http-client-0.5.0

InvalidProxyEnvironmentVariable Text Text

Values in the proxy environment variable were invalid. Provides the environment variable name and its value.

Since: http-client-0.5.0

ConnectionClosed

Attempted to use a Connection which was already closed

Since: http-client-0.5.0

InvalidProxySettings Text

Proxy settings are not valid (Windows specific currently) @since 0.5.7

proxyHost :: Proxy -> ByteString #

The host name of the HTTP proxy.

proxyPort :: Proxy -> Int #

The port number of the HTTP proxy.

data RequestBody #

When using one of the RequestBodyStream / RequestBodyStreamChunked constructors, you must ensure that the GivesPopper can be called multiple times. Usually this is not a problem.

The RequestBodyStreamChunked will send a chunked request body. Note that not all servers support this. Only use RequestBodyStreamChunked if you know the server you're sending to supports chunked request bodies.

Since 0.1.0

Constructors

RequestBodyLBS ByteString 
RequestBodyBS ByteString 
RequestBodyBuilder Int64 Builder 
RequestBodyStream Int64 (GivesPopper ()) 
RequestBodyStreamChunked (GivesPopper ()) 
RequestBodyIO (IO RequestBody)

Allows creation of a RequestBody inside the IO monad, which is useful for making easier APIs (like setRequestBodyFile).

Since: http-client-0.4.28

type Popper = IO ByteString #

A function which generates successive chunks of a request body, provider a single empty bytestring when no more data is available.

Since 0.1.0

type NeedsPopper a = Popper -> IO a #

A function which must be provided with a Popper.

Since 0.1.0

type GivesPopper a = NeedsPopper a -> IO a #

A function which will provide a Popper to a NeedsPopper. This seemingly convoluted structure allows for creation of request bodies which allocate scarce resources in an exception safe manner.

Since 0.1.0

data Request #

All information on how to connect to a host and what should be sent in the HTTP request.

If you simply wish to download from a URL, see parseRequest.

The constructor for this data type is not exposed. Instead, you should use either the defaultRequest value, or parseRequest to construct from a URL, and then use the records below to make modifications. This approach allows http-client to add configuration options without breaking backwards compatibility.

For example, to construct a POST request, you could do something like:

initReq <- parseRequest "http://www.example.com/path"
let req = initReq
            { method = "POST"
            }

For more information, please see http://www.yesodweb.com/book/settings-types.

Since 0.1.0

Instances
Show Request 
Instance details

Defined in Network.HTTP.Client.Types

data ResponseTimeout #

How to deal with timing out a response

Since: http-client-0.5.0

data Response body #

A simple representation of the HTTP response.

Since 0.1.0

Instances
Functor Response 
Instance details

Defined in Network.HTTP.Client.Types

Methods

fmap :: (a -> b) -> Response a -> Response b #

(<$) :: a -> Response b -> Response a #

Foldable Response 
Instance details

Defined in Network.HTTP.Client.Types

Methods

fold :: Monoid m => Response m -> m #

foldMap :: Monoid m => (a -> m) -> Response a -> m #

foldr :: (a -> b -> b) -> b -> Response a -> b #

foldr' :: (a -> b -> b) -> b -> Response a -> b #

foldl :: (b -> a -> b) -> b -> Response a -> b #

foldl' :: (b -> a -> b) -> b -> Response a -> b #

foldr1 :: (a -> a -> a) -> Response a -> a #

foldl1 :: (a -> a -> a) -> Response a -> a #

toList :: Response a -> [a] #

null :: Response a -> Bool #

length :: Response a -> Int #

elem :: Eq a => a -> Response a -> Bool #

maximum :: Ord a => Response a -> a #

minimum :: Ord a => Response a -> a #

sum :: Num a => Response a -> a #

product :: Num a => Response a -> a #

Traversable Response 
Instance details

Defined in Network.HTTP.Client.Types

Methods

traverse :: Applicative f => (a -> f b) -> Response a -> f (Response b) #

sequenceA :: Applicative f => Response (f a) -> f (Response a) #

mapM :: Monad m => (a -> m b) -> Response a -> m (Response b) #

sequence :: Monad m => Response (m a) -> m (Response a) #

Eq body => Eq (Response body) 
Instance details

Defined in Network.HTTP.Client.Types

Methods

(==) :: Response body -> Response body -> Bool #

(/=) :: Response body -> Response body -> Bool #

Show body => Show (Response body) 
Instance details

Defined in Network.HTTP.Client.Types

Methods

showsPrec :: Int -> Response body -> ShowS #

show :: Response body -> String #

showList :: [Response body] -> ShowS #

data ManagerSettings #

Settings for a Manager. Please use the defaultManagerSettings function and then modify individual settings. For more information, see http://www.yesodweb.com/book/settings-types.

Since 0.1.0

data ProxyOverride #

How the HTTP proxy server settings should be discovered.

Since 0.4.7

data Manager #

Keeps track of open connections for keep-alive.

If possible, you should share a single Manager between multiple threads and requests.

Since 0.1.0

Instances
HasHttpManager Manager 
Instance details

Defined in Network.HTTP.Client.Types

class HasHttpManager a where #

Minimal complete definition

getHttpManager

Methods

getHttpManager :: a -> Manager #

Instances
Has ModHttpClient α => HasHttpManager α # 
Instance details

Defined in Magicbane.Has

Methods

getHttpManager :: α -> Manager #

HasHttpManager Manager 
Instance details

Defined in Network.HTTP.Client.Types

normalizePathSegments :: String -> String #

Path segment normalization; cf. RFC3986 section 6.2.2.3

normalizeEscape :: String -> String #

Encoding normalization; cf. RFC3986 section 6.2.2.2

normalizeCase :: String -> String #

Case normalization; cf. RFC3986 section 6.2.2.1 NOTE: authority case normalization is not performed

relativeFrom :: URI -> URI -> URI #

Returns a new URI which represents the relative location of the first URI with respect to the second URI. Thus, the values supplied are expected to be absolute URIs, and the result returned may be a relative URI.

Example:

"http://example.com/Root/sub1/name2#frag"
  `relativeFrom` "http://example.com/Root/sub2/name2#frag"
  == "../sub1/name2#frag"

There is no single correct implementation of this function, but any acceptable implementation must satisfy the following:

(uabs `relativeFrom` ubase) `relativeTo` ubase == uabs

For any valid absolute URI. (cf. http://lists.w3.org/Archives/Public/uri/2003Jan/0008.html http://lists.w3.org/Archives/Public/uri/2003Jan/0005.html)

pathSegments :: URI -> [String] #

Returns the segments of the path component. E.g., pathSegments $ parseURI "http://example.org/foo/bar/baz" == ["foo", "bar", "baz"]

relativeTo :: URI -> URI -> URI #

Returns a new URI which represents the value of the first URI interpreted as relative to the second URI.

Algorithm from RFC3986 [3], section 5.2

nonStrictRelativeTo :: URI -> URI -> URI #

Returns a new URI which represents the value of the first URI interpreted as relative to the second URI. For example:

"foo" `relativeTo` "http://bar.org/" = "http://bar.org/foo"
"http:foo" `nonStrictRelativeTo` "http://bar.org/" = "http://bar.org/foo"

Algorithm from RFC3986 [3], section 5.2.2

unEscapeString :: String -> String #

Turns all instances of escaped characters in the string back into literal characters.

escapeURIString #

Arguments

:: (Char -> Bool)

a predicate which returns False if the character should be escaped

-> String

the string to process

-> String

the resulting URI string

Can be used to make a string valid for use in a URI.

escapeURIChar :: (Char -> Bool) -> Char -> String #

Escape character if supplied predicate is not satisfied, otherwise return character as singleton string.

isUnescapedInURIComponent :: Char -> Bool #

Returns True if the character is allowed unescaped in a URI component.

>>> escapeURIString isUnescapedInURIComponent "http://haskell.org:80?some_param=true&other_param=їґ"
"http%3A%2F%2Fhaskell.org%3A80%3Fsome_param%3Dtrue%26other_param%3D%D1%97%D2%91"

isUnescapedInURI :: Char -> Bool #

Returns True if the character is allowed unescaped in a URI.

>>> escapeURIString isUnescapedInURI "http://haskell.org:80?some_param=true&other_param=їґ"
"http://haskell.org:80?some_param=true&other_param=%D1%97%D2%91"

isAllowedInURI :: Char -> Bool #

Returns True if the character is allowed in a URI.

uriToString :: (String -> String) -> URI -> ShowS #

Turn a URI into a string.

Uses a supplied function to map the userinfo part of the URI.

The Show instance for URI uses a mapping that hides any password that may be present in the URI. Use this function with argument id to preserve the password in the formatted output.

isUnreserved :: Char -> Bool #

Returns True if the character is an "unreserved" character in a URI. These characters do not need to be escaped in a URI. The only characters allowed in a URI are either "reserved", "unreserved", or an escape sequence (% followed by two hex digits).

isReserved :: Char -> Bool #

Returns True if the character is a "reserved" character in a URI. To include a literal instance of one of these characters in a component of a URI, it must be escaped.

isIPv4address :: String -> Bool #

Test if string contains a valid IPv4 address

isIPv6address :: String -> Bool #

Test if string contains a valid IPv6 address

isAbsoluteURI :: String -> Bool #

Test if string contains a valid absolute URI (an absolute URI without a fragment identifier).

isRelativeReference :: String -> Bool #

Test if string contains a valid relative URI (a relative URI with optional fragment identifier).

isURIReference :: String -> Bool #

Test if string contains a valid URI reference (an absolute or relative URI with optional fragment identifier).

isURI :: String -> Bool #

Test if string contains a valid URI (an absolute URI with optional fragment identifier).

parseAbsoluteURI :: String -> Maybe URI #

Parse an absolute URI to a URI value. Returns Nothing if the string is not a valid absolute URI. (an absolute URI without a fragment identifier).

parseRelativeReference :: String -> Maybe URI #

Parse a relative URI to a URI value. Returns Nothing if the string is not a valid relative URI. (a relative URI with optional fragment identifier).

parseURIReference :: String -> Maybe URI #

Parse a URI reference to a URI value. Returns Nothing if the string is not a valid URI reference. (an absolute or relative URI with optional fragment identifier).

parseURI :: String -> Maybe URI #

Turn a string containing a URI into a URI. Returns Nothing if the string is not a valid URI; (an absolute URI with optional fragment identifier).

NOTE: this is different from the previous network.URI, whose parseURI function works like parseURIReference in this module.

nullURI :: URI #

Blank URI

data URIAuth #

Type for authority value within a URI

Constructors

URIAuth 

Fields

Instances
Eq URIAuth 
Instance details

Defined in Network.URI

Methods

(==) :: URIAuth -> URIAuth -> Bool #

(/=) :: URIAuth -> URIAuth -> Bool #

Data URIAuth 
Instance details

Defined in Network.URI

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> URIAuth -> c URIAuth #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c URIAuth #

toConstr :: URIAuth -> Constr #

dataTypeOf :: URIAuth -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c URIAuth) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c URIAuth) #

gmapT :: (forall b. Data b => b -> b) -> URIAuth -> URIAuth #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> URIAuth -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> URIAuth -> r #

gmapQ :: (forall d. Data d => d -> u) -> URIAuth -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> URIAuth -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> URIAuth -> m URIAuth #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> URIAuth -> m URIAuth #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> URIAuth -> m URIAuth #

Ord URIAuth 
Instance details

Defined in Network.URI

Show URIAuth 
Instance details

Defined in Network.URI

NFData URIAuth 
Instance details

Defined in Network.URI

Methods

rnf :: URIAuth -> () #