    {-# LANGUAGE CPP #-}
    {-# LANGUAGE DeriveDataTypeable #-}
    {-# LANGUAGE DeriveTraversable #-}
    {-# LANGUAGE GeneralizedNewtypeDeriving #-}
    {-# LANGUAGE OverloadedStrings #-}
    {-# LANGUAGE RankNTypes #-}
    module Network.HTTP.Client.Types
        ( BodyReader
        , Connection (..)
        , StatusHeaders (..)
        , HttpException (..)
        , HttpExceptionContent (..)
        , unHttpExceptionContentWrapper
        , throwHttp
        , toHttpException
        , Cookie (..)
        , equalCookie
        , equivCookie
        , compareCookies
        , CookieJar (..)
        , equalCookieJar
        , equivCookieJar
        , Proxy (..)
        , RequestBody (..)
        , Popper
        , NeedsPopper
        , GivesPopper
        , Request (..)
        , Response (..)
        , ResponseClose (..)
        , Manager (..)
        , HasHttpManager (..)
        , ConnsMap (..)
        , ManagerSettings (..)
        , NonEmptyList (..)
        , ConnHost (..)
        , ConnKey (..)
        , ProxyOverride (..)
        , StreamFileStatus (..)
        , ResponseTimeout (..)
        , ProxySecureMode (..)
        , MaxHeaderLength (..)
        , MaxNumberHeaders (..)
        ) where

    import qualified Data.Typeable as T (Typeable)
    import Network.HTTP.Types
    import Control.Exception (Exception, SomeException, throwIO)
    import Data.Word (Word64)
    import qualified Data.ByteString as S
    import qualified Data.ByteString.Lazy as L
    import Blaze.ByteString.Builder (Builder, fromLazyByteString, fromByteString, toLazyByteString)
    import Data.Int (Int64)
    import Data.Foldable (Foldable)
    import Data.Monoid (Monoid(..))
    import Data.Semigroup (Semigroup(..))
    import Data.String (IsString, fromString)
    import Data.Time (UTCTime)
    import Data.Traversable (Traversable)
    import qualified Data.List as DL
    import Network.Socket (HostAddress)
    import Data.IORef
    import qualified Network.Socket as NS
    import qualified Data.Map as Map
    import qualified Data.Set as Set
    import Data.Text (Text)
    import Data.Streaming.Zlib (ZlibException)
    import Data.CaseInsensitive as CI
    import Data.KeyedPool (KeyedPool)

    -- | 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
    type BodyReader = IO S.ByteString

    data Connection = Connection
        { Connection -> IO ByteString
    connectionRead :: IO S.ByteString
          -- ^ If no more data, return empty.
        , Connection -> ByteString -> IO ()
    connectionUnread :: S.ByteString -> IO ()
          -- ^ Return data to be read next time.
        , Connection -> ByteString -> IO ()
    connectionWrite :: S.ByteString -> IO ()
          -- ^ Send data to server
        , Connection -> IO ()
    connectionClose :: IO ()
          -- ^ Close connection. Any successive operation on the connection
          -- (except closing) should fail with `ConnectionClosed` exception.
          -- It is allowed to close connection multiple times.
        }
        deriving T.Typeable

    data StatusHeaders = StatusHeaders Status HttpVersion RequestHeaders RequestHeaders
        deriving (Int -> StatusHeaders -> ShowS
    [StatusHeaders] -> ShowS
    StatusHeaders -> String
    (Int -> StatusHeaders -> ShowS)
    -> (StatusHeaders -> String)
    -> ([StatusHeaders] -> ShowS)
    -> Show StatusHeaders
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> StatusHeaders -> ShowS
    showsPrec :: Int -> StatusHeaders -> ShowS
    $cshow :: StatusHeaders -> String
    show :: StatusHeaders -> String
    $cshowList :: [StatusHeaders] -> ShowS
    showList :: [StatusHeaders] -> ShowS
    Show, StatusHeaders -> StatusHeaders -> Bool
    (StatusHeaders -> StatusHeaders -> Bool)
    -> (StatusHeaders -> StatusHeaders -> Bool) -> Eq StatusHeaders
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: StatusHeaders -> StatusHeaders -> Bool
    == :: StatusHeaders -> StatusHeaders -> Bool
    $c/= :: StatusHeaders -> StatusHeaders -> Bool
    /= :: StatusHeaders -> StatusHeaders -> Bool
    Eq, Eq StatusHeaders
    Eq StatusHeaders =>
    (StatusHeaders -> StatusHeaders -> Ordering)
    -> (StatusHeaders -> StatusHeaders -> Bool)
    -> (StatusHeaders -> StatusHeaders -> Bool)
    -> (StatusHeaders -> StatusHeaders -> Bool)
    -> (StatusHeaders -> StatusHeaders -> Bool)
    -> (StatusHeaders -> StatusHeaders -> StatusHeaders)
    -> (StatusHeaders -> StatusHeaders -> StatusHeaders)
    -> Ord StatusHeaders
    StatusHeaders -> StatusHeaders -> Bool
    StatusHeaders -> StatusHeaders -> Ordering
    StatusHeaders -> StatusHeaders -> StatusHeaders
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: StatusHeaders -> StatusHeaders -> Ordering
    compare :: StatusHeaders -> StatusHeaders -> Ordering
    $c< :: StatusHeaders -> StatusHeaders -> Bool
    < :: StatusHeaders -> StatusHeaders -> Bool
    $c<= :: StatusHeaders -> StatusHeaders -> Bool
    <= :: StatusHeaders -> StatusHeaders -> Bool
    $c> :: StatusHeaders -> StatusHeaders -> Bool
    > :: StatusHeaders -> StatusHeaders -> Bool
    $c>= :: StatusHeaders -> StatusHeaders -> Bool
    >= :: StatusHeaders -> StatusHeaders -> Bool
    $cmax :: StatusHeaders -> StatusHeaders -> StatusHeaders
    max :: StatusHeaders -> StatusHeaders -> StatusHeaders
    $cmin :: StatusHeaders -> StatusHeaders -> StatusHeaders
    min :: StatusHeaders -> StatusHeaders -> StatusHeaders
    Ord, T.Typeable)

    -- | A newtype wrapper which is not exported from this library but is an
    -- instance of @Exception@. This allows @HttpExceptionContent@ to be thrown
    -- (via this wrapper), but users of the library can't accidentally try to catch
    -- it (when they /should/ be trying to catch 'HttpException').
    --
    -- @since 0.5.0
    newtype HttpExceptionContentWrapper = HttpExceptionContentWrapper
        { HttpExceptionContentWrapper -> HttpExceptionContent
    unHttpExceptionContentWrapper :: HttpExceptionContent
        }
        deriving (Int -> HttpExceptionContentWrapper -> ShowS
    [HttpExceptionContentWrapper] -> ShowS
    HttpExceptionContentWrapper -> String
    (Int -> HttpExceptionContentWrapper -> ShowS)
    -> (HttpExceptionContentWrapper -> String)
    -> ([HttpExceptionContentWrapper] -> ShowS)
    -> Show HttpExceptionContentWrapper
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> HttpExceptionContentWrapper -> ShowS
    showsPrec :: Int -> HttpExceptionContentWrapper -> ShowS
    $cshow :: HttpExceptionContentWrapper -> String
    show :: HttpExceptionContentWrapper -> String
    $cshowList :: [HttpExceptionContentWrapper] -> ShowS
    showList :: [HttpExceptionContentWrapper] -> ShowS
    Show, T.Typeable)
    instance Exception HttpExceptionContentWrapper

    throwHttp :: HttpExceptionContent -> IO a
    throwHttp :: forall a. HttpExceptionContent -> IO a
    throwHttp = HttpExceptionContentWrapper -> IO a
    forall e a. (HasCallStack, Exception e) => e -> IO a
    throwIO (HttpExceptionContentWrapper -> IO a)
    -> (HttpExceptionContent -> HttpExceptionContentWrapper)
    -> HttpExceptionContent
    -> IO a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . HttpExceptionContent -> HttpExceptionContentWrapper
    HttpExceptionContentWrapper

    toHttpException :: Request -> HttpExceptionContentWrapper -> HttpException
    toHttpException :: Request -> HttpExceptionContentWrapper -> HttpException
    toHttpException Request
    req (HttpExceptionContentWrapper HttpExceptionContent
    e) = Request -> HttpExceptionContent -> HttpException
    HttpExceptionRequest Request
    req HttpExceptionContent
    e

    -- | An exception which may be generated by this library
    --
    -- @since 0.5.0
    data HttpException
        = HttpExceptionRequest Request HttpExceptionContent
        -- ^ Most exceptions are specific to a 'Request'. Inspect the
        -- 'HttpExceptionContent' value for details on what occurred.
        --
        -- @since 0.5.0
        | InvalidUrlException String String
        -- ^ A URL (first field) is invalid for a given reason
        -- (second argument).
        --
        -- @since 0.5.0
        deriving (Int -> HttpException -> ShowS
    [HttpException] -> ShowS
    HttpException -> String
    (Int -> HttpException -> ShowS)
    -> (HttpException -> String)
    -> ([HttpException] -> ShowS)
    -> Show HttpException
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> HttpException -> ShowS
    showsPrec :: Int -> HttpException -> ShowS
    $cshow :: HttpException -> String
    show :: HttpException -> String
    $cshowList :: [HttpException] -> ShowS
    showList :: [HttpException] -> ShowS
    Show, T.Typeable)
    instance Exception HttpException

    data HttpExceptionContent
                       = StatusCodeException (Response ()) S.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 0.5.0
                       | TooManyRedirects [Response L.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 0.5.0
                       | OverlongHeaders
                       -- ^ Too many total bytes in the HTTP header were returned
                       -- by the server.
                       --
                       -- @since 0.5.0
                       | TooManyHeaderFields
                       -- ^ Too many HTTP header fields were returned by the server.
                       --
                       -- @since 0.7.18
                       | ResponseTimeout
                       -- ^ The server took too long to return a response. This can
                       -- be altered via 'responseTimeout' or
                       -- 'managerResponseTimeout'.
                       --
                       -- @since 0.5.0
                       | ConnectionTimeout
                       -- ^ Attempting to connect to the server timed out.
                       --
                       -- @since 0.5.0
                       | ConnectionFailure SomeException
                       -- ^ An exception occurred when trying to connect to the
                       -- server.
                       --
                       -- @since 0.5.0
                       | InvalidStatusLine S.ByteString
                       -- ^ The status line returned by the server could not be parsed.
                       --
                       -- @since 0.5.0
                       | InvalidHeader S.ByteString
                       -- ^ The given response header line could not be parsed
                       --
                       -- @since 0.5.0
                       | InvalidRequestHeader S.ByteString
                       -- ^ The given request header is not compliant (e.g. has newlines)
                       --
                       -- @since 0.5.14
                       | 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 0.5.0
                       | ProxyConnectException S.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 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 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 0.5.0
                       | WrongRequestBodyStreamSize Word64 Word64
                       -- ^ The request body provided did not match the expected size.
                       --
                       -- Provides the expected and actual size.
                       --
                       -- @since 0.4.31
                       | ResponseBodyTooShort Word64 Word64
                       -- ^ The returned response body is too short. Provides the
                       -- expected size and actual size.
                       --
                       -- @since 0.5.0
                       | InvalidChunkHeaders
                       -- ^ A chunked response body had invalid headers.
                       --
                       -- @since 0.5.0
                       | IncompleteHeaders
                       -- ^ An incomplete set of response headers were returned.
                       --
                       -- @since 0.5.0
                       | InvalidDestinationHost S.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 0.5.0
                       | InvalidProxyEnvironmentVariable Text Text
                       -- ^ Values in the proxy environment variable were invalid.
                       -- Provides the environment variable name and its value.
                       --
                       -- @since 0.5.0
                       | ConnectionClosed
                       -- ^ Attempted to use a 'Connection' which was already closed
                       --
                       -- @since 0.5.0
                       | InvalidProxySettings Text
                       -- ^ Proxy settings are not valid (Windows specific currently)
                       -- @since 0.5.7
        deriving (Int -> HttpExceptionContent -> ShowS
    [HttpExceptionContent] -> ShowS
    HttpExceptionContent -> String
    (Int -> HttpExceptionContent -> ShowS)
    -> (HttpExceptionContent -> String)
    -> ([HttpExceptionContent] -> ShowS)
    -> Show HttpExceptionContent
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> HttpExceptionContent -> ShowS
    showsPrec :: Int -> HttpExceptionContent -> ShowS
    $cshow :: HttpExceptionContent -> String
    show :: HttpExceptionContent -> String
    $cshowList :: [HttpExceptionContent] -> ShowS
    showList :: [HttpExceptionContent] -> ShowS
    Show, T.Typeable)

    -- Purposely not providing this instance, since we don't want users to
    -- accidentally try and catch these exceptions instead of HttpException
    --
    -- instance Exception HttpExceptionContent

    -- This corresponds to the description of a cookie detailed in Section 5.3 \"Storage Model\"
    data Cookie = Cookie
      { Cookie -> ByteString
    cookie_name :: S.ByteString
      , Cookie -> ByteString
    cookie_value :: S.ByteString
      , Cookie -> UTCTime
    cookie_expiry_time :: UTCTime
      , Cookie -> ByteString
    cookie_domain :: S.ByteString
      , Cookie -> ByteString
    cookie_path :: S.ByteString
      , Cookie -> UTCTime
    cookie_creation_time :: UTCTime
      , Cookie -> UTCTime
    cookie_last_access_time :: UTCTime
      , Cookie -> Bool
    cookie_persistent :: Bool
      , Cookie -> Bool
    cookie_host_only :: Bool
      , Cookie -> Bool
    cookie_secure_only :: Bool
      , Cookie -> Bool
    cookie_http_only :: Bool
      }
      deriving (ReadPrec [Cookie]
    ReadPrec Cookie
    Int -> ReadS Cookie
    ReadS [Cookie]
    (Int -> ReadS Cookie)
    -> ReadS [Cookie]
    -> ReadPrec Cookie
    -> ReadPrec [Cookie]
    -> Read Cookie
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS Cookie
    readsPrec :: Int -> ReadS Cookie
    $creadList :: ReadS [Cookie]
    readList :: ReadS [Cookie]
    $creadPrec :: ReadPrec Cookie
    readPrec :: ReadPrec Cookie
    $creadListPrec :: ReadPrec [Cookie]
    readListPrec :: ReadPrec [Cookie]
    Read, Int -> Cookie -> ShowS
    [Cookie] -> ShowS
    Cookie -> String
    (Int -> Cookie -> ShowS)
    -> (Cookie -> String) -> ([Cookie] -> ShowS) -> Show Cookie
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Cookie -> ShowS
    showsPrec :: Int -> Cookie -> ShowS
    $cshow :: Cookie -> String
    show :: Cookie -> String
    $cshowList :: [Cookie] -> ShowS
    showList :: [Cookie] -> ShowS
    Show, T.Typeable)

    newtype CookieJar = CJ { CookieJar -> [Cookie]
    expose :: [Cookie] }
      deriving (ReadPrec [CookieJar]
    ReadPrec CookieJar
    Int -> ReadS CookieJar
    ReadS [CookieJar]
    (Int -> ReadS CookieJar)
    -> ReadS [CookieJar]
    -> ReadPrec CookieJar
    -> ReadPrec [CookieJar]
    -> Read CookieJar
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS CookieJar
    readsPrec :: Int -> ReadS CookieJar
    $creadList :: ReadS [CookieJar]
    readList :: ReadS [CookieJar]
    $creadPrec :: ReadPrec CookieJar
    readPrec :: ReadPrec CookieJar
    $creadListPrec :: ReadPrec [CookieJar]
    readListPrec :: ReadPrec [CookieJar]
    Read, Int -> CookieJar -> ShowS
    [CookieJar] -> ShowS
    CookieJar -> String
    (Int -> CookieJar -> ShowS)
    -> (CookieJar -> String)
    -> ([CookieJar] -> ShowS)
    -> Show CookieJar
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> CookieJar -> ShowS
    showsPrec :: Int -> CookieJar -> ShowS
    $cshow :: CookieJar -> String
    show :: CookieJar -> String
    $cshowList :: [CookieJar] -> ShowS
    showList :: [CookieJar] -> ShowS
    Show, T.Typeable)

    -- | Instead of '(==)'.
    --
    -- Since there was some confusion in the history of this library about how the 'Eq' instance
    -- should work, it was removed for clarity, and replaced by 'equal' and 'equiv'.  'equal'
    -- gives you equality of all fields of the 'Cookie' record.
    --
    -- @since 0.7.0
    equalCookie :: Cookie -> Cookie -> Bool
    equalCookie :: Cookie -> Cookie -> Bool
    equalCookie Cookie
    a Cookie
    b = [Bool] -> Bool
    forall (t :: * -> *). Foldable t => t Bool -> Bool
    and
      [ Cookie -> ByteString
    cookie_name Cookie
    a ByteString -> ByteString -> Bool
    forall a. Eq a => a -> a -> Bool
    == Cookie -> ByteString
    cookie_name Cookie
    b
      , Cookie -> ByteString
    cookie_value Cookie
    a ByteString -> ByteString -> Bool
    forall a. Eq a => a -> a -> Bool
    == Cookie -> ByteString
    cookie_value Cookie
    b
      , Cookie -> UTCTime
    cookie_expiry_time Cookie
    a UTCTime -> UTCTime -> Bool
    forall a. Eq a => a -> a -> Bool
    == Cookie -> UTCTime
    cookie_expiry_time Cookie
    b
      , Cookie -> ByteString
    cookie_domain Cookie
    a ByteString -> ByteString -> Bool
    forall a. Eq a => a -> a -> Bool
    == Cookie -> ByteString
    cookie_domain Cookie
    b
      , Cookie -> ByteString
    cookie_path Cookie
    a ByteString -> ByteString -> Bool
    forall a. Eq a => a -> a -> Bool
    == Cookie -> ByteString
    cookie_path Cookie
    b
      , Cookie -> UTCTime
    cookie_creation_time Cookie
    a UTCTime -> UTCTime -> Bool
    forall a. Eq a => a -> a -> Bool
    == Cookie -> UTCTime
    cookie_creation_time Cookie
    b
      , Cookie -> UTCTime
    cookie_last_access_time Cookie
    a UTCTime -> UTCTime -> Bool
    forall a. Eq a => a -> a -> Bool
    == Cookie -> UTCTime
    cookie_last_access_time Cookie
    b
      , Cookie -> Bool
    cookie_persistent Cookie
    a Bool -> Bool -> Bool
    forall a. Eq a => a -> a -> Bool
    == Cookie -> Bool
    cookie_persistent Cookie
    b
      , Cookie -> Bool
    cookie_host_only Cookie
    a Bool -> Bool -> Bool
    forall a. Eq a => a -> a -> Bool
    == Cookie -> Bool
    cookie_host_only Cookie
    b
      , Cookie -> Bool
    cookie_secure_only Cookie
    a Bool -> Bool -> Bool
    forall a. Eq a => a -> a -> Bool
    == Cookie -> Bool
    cookie_secure_only Cookie
    b
      , Cookie -> Bool
    cookie_http_only Cookie
    a Bool -> Bool -> Bool
    forall a. Eq a => a -> a -> Bool
    == Cookie -> Bool
    cookie_http_only Cookie
    b
      ]

    -- | Equality of name, domain, path only.  This corresponds to step 11 of the algorithm
    -- described in Section 5.3 \"Storage Model\".  See also: 'equal'.
    --
    -- @since 0.7.0
    equivCookie :: Cookie -> Cookie -> Bool
    equivCookie :: Cookie -> Cookie -> Bool
    equivCookie Cookie
    a Cookie
    b = Bool
    name_matches Bool -> Bool -> Bool
    && Bool
    domain_matches Bool -> Bool -> Bool
    && Bool
    path_matches
      where name_matches :: Bool
    name_matches = Cookie -> ByteString
    cookie_name Cookie
    a ByteString -> ByteString -> Bool
    forall a. Eq a => a -> a -> Bool
    == Cookie -> ByteString
    cookie_name Cookie
    b
            domain_matches :: Bool
    domain_matches = ByteString -> ByteString
    forall s. FoldCase s => s -> s
    CI.foldCase (Cookie -> ByteString
    cookie_domain Cookie
    a) ByteString -> ByteString -> Bool
    forall a. Eq a => a -> a -> Bool
    == ByteString -> ByteString
    forall s. FoldCase s => s -> s
    CI.foldCase (Cookie -> ByteString
    cookie_domain Cookie
    b)
            path_matches :: Bool
    path_matches = Cookie -> ByteString
    cookie_path Cookie
    a ByteString -> ByteString -> Bool
    forall a. Eq a => a -> a -> Bool
    == Cookie -> ByteString
    cookie_path Cookie
    b

    -- | Instead of @instance Ord Cookie@.  See 'equalCookie', 'equivCookie'.
    --
    -- @since 0.7.0
    compareCookies :: Cookie -> Cookie -> Ordering
    compareCookies :: Cookie -> Cookie -> Ordering
    compareCookies Cookie
    c1 Cookie
    c2
        | ByteString -> Int
    S.length (Cookie -> ByteString
    cookie_path Cookie
    c1) Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    > ByteString -> Int
    S.length (Cookie -> ByteString
    cookie_path Cookie
    c2) = Ordering
    LT
        | ByteString -> Int
    S.length (Cookie -> ByteString
    cookie_path Cookie
    c1) Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    < ByteString -> Int
    S.length (Cookie -> ByteString
    cookie_path Cookie
    c2) = Ordering
    GT
        | Cookie -> UTCTime
    cookie_creation_time Cookie
    c1 UTCTime -> UTCTime -> Bool
    forall a. Ord a => a -> a -> Bool
    > Cookie -> UTCTime
    cookie_creation_time Cookie
    c2 = Ordering
    GT
        | Bool
    otherwise = Ordering
    LT

    -- | See 'equalCookie'.
    --
    -- @since 0.7.0
    equalCookieJar :: CookieJar -> CookieJar -> Bool
    equalCookieJar :: CookieJar -> CookieJar -> Bool
    equalCookieJar (CJ [Cookie]
    cj1) (CJ [Cookie]
    cj2) = [Bool] -> Bool
    forall (t :: * -> *). Foldable t => t Bool -> Bool
    and ([Bool] -> Bool) -> [Bool] -> Bool
    forall a b. (a -> b) -> a -> b
    $ (Cookie -> Cookie -> Bool) -> [Cookie] -> [Cookie] -> [Bool]
    forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
    zipWith Cookie -> Cookie -> Bool
    equalCookie [Cookie]
    cj1 [Cookie]
    cj2

    -- | See 'equalCookieJar', 'equalCookie'.
    --
    -- @since 0.7.0
    equivCookieJar :: CookieJar -> CookieJar -> Bool
    equivCookieJar :: CookieJar -> CookieJar -> Bool
    equivCookieJar CookieJar
    cj1 CookieJar
    cj2 = [Bool] -> Bool
    forall (t :: * -> *). Foldable t => t Bool -> Bool
    and ([Bool] -> Bool) -> [Bool] -> Bool
    forall a b. (a -> b) -> a -> b
    $
      (Cookie -> Cookie -> Bool) -> [Cookie] -> [Cookie] -> [Bool]
    forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
    zipWith Cookie -> Cookie -> Bool
    equivCookie ((Cookie -> Cookie -> Ordering) -> [Cookie] -> [Cookie]
    forall a. (a -> a -> Ordering) -> [a] -> [a]
    DL.sortBy Cookie -> Cookie -> Ordering
    compareCookies ([Cookie] -> [Cookie]) -> [Cookie] -> [Cookie]
    forall a b. (a -> b) -> a -> b
    $ CookieJar -> [Cookie]
    expose CookieJar
    cj1) ((Cookie -> Cookie -> Ordering) -> [Cookie] -> [Cookie]
    forall a. (a -> a -> Ordering) -> [a] -> [a]
    DL.sortBy Cookie -> Cookie -> Ordering
    compareCookies ([Cookie] -> [Cookie]) -> [Cookie] -> [Cookie]
    forall a b. (a -> b) -> a -> b
    $ CookieJar -> [Cookie]
    expose CookieJar
    cj2)

    instance Semigroup CookieJar where
      (CJ [Cookie]
    a) <> :: CookieJar -> CookieJar -> CookieJar
    <> (CJ [Cookie]
    b) = [Cookie] -> CookieJar
    CJ ((Cookie -> Cookie -> Bool) -> [Cookie] -> [Cookie]
    forall a. (a -> a -> Bool) -> [a] -> [a]
    DL.nubBy Cookie -> Cookie -> Bool
    equivCookie ([Cookie] -> [Cookie]) -> [Cookie] -> [Cookie]
    forall a b. (a -> b) -> a -> b
    $ (Cookie -> Cookie -> Ordering) -> [Cookie] -> [Cookie]
    forall a. (a -> a -> Ordering) -> [a] -> [a]
    DL.sortBy Cookie -> Cookie -> Ordering
    mostRecentFirst ([Cookie] -> [Cookie]) -> [Cookie] -> [Cookie]
    forall a b. (a -> b) -> a -> b
    $ [Cookie]
    a [Cookie] -> [Cookie] -> [Cookie]
    forall a. Semigroup a => a -> a -> a
    <> [Cookie]
    b)
        where mostRecentFirst :: Cookie -> Cookie -> Ordering
    mostRecentFirst Cookie
    c1 Cookie
    c2 =
                -- inverse so that recent cookies are kept by nub over older
                if Cookie -> UTCTime
    cookie_creation_time Cookie
    c1 UTCTime -> UTCTime -> Bool
    forall a. Ord a => a -> a -> Bool
    > Cookie -> UTCTime
    cookie_creation_time Cookie
    c2
                    then Ordering
    LT
                    else Ordering
    GT

    -- | Since 1.9
    instance Data.Monoid.Monoid CookieJar where
      mempty :: CookieJar
    mempty = [Cookie] -> CookieJar
    CJ []
    #if !(MIN_VERSION_base(4,11,0))
      mappend = (<>)
    #endif

    -- | Define a HTTP proxy, consisting of a hostname and port number.

    data Proxy = Proxy
        { Proxy -> ByteString
    proxyHost :: S.ByteString -- ^ The host name of the HTTP proxy in URI format. IPv6 addresses in square brackets.
        , Proxy -> Int
    proxyPort :: Int -- ^ The port number of the HTTP proxy.
        }
        deriving (Int -> Proxy -> ShowS
    [Proxy] -> ShowS
    Proxy -> String
    (Int -> Proxy -> ShowS)
    -> (Proxy -> String) -> ([Proxy] -> ShowS) -> Show Proxy
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Proxy -> ShowS
    showsPrec :: Int -> Proxy -> ShowS
    $cshow :: Proxy -> String
    show :: Proxy -> String
    $cshowList :: [Proxy] -> ShowS
    showList :: [Proxy] -> ShowS
    Show, ReadPrec [Proxy]
    ReadPrec Proxy
    Int -> ReadS Proxy
    ReadS [Proxy]
    (Int -> ReadS Proxy)
    -> ReadS [Proxy]
    -> ReadPrec Proxy
    -> ReadPrec [Proxy]
    -> Read Proxy
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS Proxy
    readsPrec :: Int -> ReadS Proxy
    $creadList :: ReadS [Proxy]
    readList :: ReadS [Proxy]
    $creadPrec :: ReadPrec Proxy
    readPrec :: ReadPrec Proxy
    $creadListPrec :: ReadPrec [Proxy]
    readListPrec :: ReadPrec [Proxy]
    Read, Proxy -> Proxy -> Bool
    (Proxy -> Proxy -> Bool) -> (Proxy -> Proxy -> Bool) -> Eq Proxy
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Proxy -> Proxy -> Bool
    == :: Proxy -> Proxy -> Bool
    $c/= :: Proxy -> Proxy -> Bool
    /= :: Proxy -> Proxy -> Bool
    Eq, Eq Proxy
    Eq Proxy =>
    (Proxy -> Proxy -> Ordering)
    -> (Proxy -> Proxy -> Bool)
    -> (Proxy -> Proxy -> Bool)
    -> (Proxy -> Proxy -> Bool)
    -> (Proxy -> Proxy -> Bool)
    -> (Proxy -> Proxy -> Proxy)
    -> (Proxy -> Proxy -> Proxy)
    -> Ord Proxy
    Proxy -> Proxy -> Bool
    Proxy -> Proxy -> Ordering
    Proxy -> Proxy -> Proxy
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: Proxy -> Proxy -> Ordering
    compare :: Proxy -> Proxy -> Ordering
    $c< :: Proxy -> Proxy -> Bool
    < :: Proxy -> Proxy -> Bool
    $c<= :: Proxy -> Proxy -> Bool
    <= :: Proxy -> Proxy -> Bool
    $c> :: Proxy -> Proxy -> Bool
    > :: Proxy -> Proxy -> Bool
    $c>= :: Proxy -> Proxy -> Bool
    >= :: Proxy -> Proxy -> Bool
    $cmax :: Proxy -> Proxy -> Proxy
    max :: Proxy -> Proxy -> Proxy
    $cmin :: Proxy -> Proxy -> Proxy
    min :: Proxy -> Proxy -> Proxy
    Ord, T.Typeable)

    -- | Define how to make secure connections using a proxy server.
    data ProxySecureMode =
      ProxySecureWithConnect
      -- ^ Use the HTTP CONNECT verb to forward a secure connection through the proxy.
      | ProxySecureWithoutConnect
      -- ^ Send the request directly to the proxy with an https URL. This mode can be
      -- used to offload TLS handling to a trusted local proxy.
      deriving (Int -> ProxySecureMode -> ShowS
    [ProxySecureMode] -> ShowS
    ProxySecureMode -> String
    (Int -> ProxySecureMode -> ShowS)
    -> (ProxySecureMode -> String)
    -> ([ProxySecureMode] -> ShowS)
    -> Show ProxySecureMode
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> ProxySecureMode -> ShowS
    showsPrec :: Int -> ProxySecureMode -> ShowS
    $cshow :: ProxySecureMode -> String
    show :: ProxySecureMode -> String
    $cshowList :: [ProxySecureMode] -> ShowS
    showList :: [ProxySecureMode] -> ShowS
    Show, ReadPrec [ProxySecureMode]
    ReadPrec ProxySecureMode
    Int -> ReadS ProxySecureMode
    ReadS [ProxySecureMode]
    (Int -> ReadS ProxySecureMode)
    -> ReadS [ProxySecureMode]
    -> ReadPrec ProxySecureMode
    -> ReadPrec [ProxySecureMode]
    -> Read ProxySecureMode
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS ProxySecureMode
    readsPrec :: Int -> ReadS ProxySecureMode
    $creadList :: ReadS [ProxySecureMode]
    readList :: ReadS [ProxySecureMode]
    $creadPrec :: ReadPrec ProxySecureMode
    readPrec :: ReadPrec ProxySecureMode
    $creadListPrec :: ReadPrec [ProxySecureMode]
    readListPrec :: ReadPrec [ProxySecureMode]
    Read, ProxySecureMode -> ProxySecureMode -> Bool
    (ProxySecureMode -> ProxySecureMode -> Bool)
    -> (ProxySecureMode -> ProxySecureMode -> Bool)
    -> Eq ProxySecureMode
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ProxySecureMode -> ProxySecureMode -> Bool
    == :: ProxySecureMode -> ProxySecureMode -> Bool
    $c/= :: ProxySecureMode -> ProxySecureMode -> Bool
    /= :: ProxySecureMode -> ProxySecureMode -> Bool
    Eq, Eq ProxySecureMode
    Eq ProxySecureMode =>
    (ProxySecureMode -> ProxySecureMode -> Ordering)
    -> (ProxySecureMode -> ProxySecureMode -> Bool)
    -> (ProxySecureMode -> ProxySecureMode -> Bool)
    -> (ProxySecureMode -> ProxySecureMode -> Bool)
    -> (ProxySecureMode -> ProxySecureMode -> Bool)
    -> (ProxySecureMode -> ProxySecureMode -> ProxySecureMode)
    -> (ProxySecureMode -> ProxySecureMode -> ProxySecureMode)
    -> Ord ProxySecureMode
    ProxySecureMode -> ProxySecureMode -> Bool
    ProxySecureMode -> ProxySecureMode -> Ordering
    ProxySecureMode -> ProxySecureMode -> ProxySecureMode
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: ProxySecureMode -> ProxySecureMode -> Ordering
    compare :: ProxySecureMode -> ProxySecureMode -> Ordering
    $c< :: ProxySecureMode -> ProxySecureMode -> Bool
    < :: ProxySecureMode -> ProxySecureMode -> Bool
    $c<= :: ProxySecureMode -> ProxySecureMode -> Bool
    <= :: ProxySecureMode -> ProxySecureMode -> Bool
    $c> :: ProxySecureMode -> ProxySecureMode -> Bool
    > :: ProxySecureMode -> ProxySecureMode -> Bool
    $c>= :: ProxySecureMode -> ProxySecureMode -> Bool
    >= :: ProxySecureMode -> ProxySecureMode -> Bool
    $cmax :: ProxySecureMode -> ProxySecureMode -> ProxySecureMode
    max :: ProxySecureMode -> ProxySecureMode -> ProxySecureMode
    $cmin :: ProxySecureMode -> ProxySecureMode -> ProxySecureMode
    min :: ProxySecureMode -> ProxySecureMode -> ProxySecureMode
    Ord, T.Typeable)

    -- | 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
    data RequestBody
        = RequestBodyLBS L.ByteString
        | RequestBodyBS S.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 0.4.28
        deriving T.Typeable
    -- |
    --
    -- Since 0.4.12
    instance IsString RequestBody where
        fromString :: String -> RequestBody
    fromString String
    str = ByteString -> RequestBody
    RequestBodyBS (String -> ByteString
    forall a. IsString a => String -> a
    fromString String
    str)
    instance Monoid RequestBody where
        mempty :: RequestBody
    mempty = ByteString -> RequestBody
    RequestBodyBS ByteString
    S.empty
    #if !(MIN_VERSION_base(4,11,0))
        mappend = (<>)
    #endif

    instance Semigroup RequestBody where
        RequestBody
    x0 <> :: RequestBody -> RequestBody -> RequestBody
    <> RequestBody
    y0 =
            case (RequestBody
    -> Either (Int64, Builder) (Maybe Int64, GivesPopper ())
    simplify RequestBody
    x0, RequestBody
    -> Either (Int64, Builder) (Maybe Int64, GivesPopper ())
    simplify RequestBody
    y0) of
                (Left (Int64
    i, Builder
    x), Left (Int64
    j, Builder
    y)) -> Int64 -> Builder -> RequestBody
    RequestBodyBuilder (Int64
    i Int64 -> Int64 -> Int64
    forall a. Num a => a -> a -> a
    + Int64
    j) (Builder
    x Builder -> Builder -> Builder
    forall a. Semigroup a => a -> a -> a
    <> Builder
    y)
                (Left (Int64, Builder)
    x, Right (Maybe Int64, GivesPopper ())
    y) -> (Maybe Int64, GivesPopper ())
    -> (Maybe Int64, GivesPopper ()) -> RequestBody
    combine ((Int64, Builder) -> (Maybe Int64, GivesPopper ())
    builderToStream (Int64, Builder)
    x) (Maybe Int64, GivesPopper ())
    y
                (Right (Maybe Int64, GivesPopper ())
    x, Left (Int64, Builder)
    y) -> (Maybe Int64, GivesPopper ())
    -> (Maybe Int64, GivesPopper ()) -> RequestBody
    combine (Maybe Int64, GivesPopper ())
    x ((Int64, Builder) -> (Maybe Int64, GivesPopper ())
    builderToStream (Int64, Builder)
    y)
                (Right (Maybe Int64, GivesPopper ())
    x, Right (Maybe Int64, GivesPopper ())
    y) -> (Maybe Int64, GivesPopper ())
    -> (Maybe Int64, GivesPopper ()) -> RequestBody
    combine (Maybe Int64, GivesPopper ())
    x (Maybe Int64, GivesPopper ())
    y
          where
            combine :: (Maybe Int64, GivesPopper ())
    -> (Maybe Int64, GivesPopper ()) -> RequestBody
    combine (Just Int64
    i, GivesPopper ()
    x) (Just Int64
    j, GivesPopper ()
    y) = Int64 -> GivesPopper () -> RequestBody
    RequestBodyStream (Int64
    i Int64 -> Int64 -> Int64
    forall a. Num a => a -> a -> a
    + Int64
    j) (GivesPopper () -> GivesPopper () -> GivesPopper ()
    combine' GivesPopper ()
    x GivesPopper ()
    y)
            combine (Maybe Int64
    _, GivesPopper ()
    x) (Maybe Int64
    _, GivesPopper ()
    y) = GivesPopper () -> RequestBody
    RequestBodyStreamChunked (GivesPopper () -> GivesPopper () -> GivesPopper ()
    combine' GivesPopper ()
    x GivesPopper ()
    y)

            combine' :: GivesPopper () -> GivesPopper () -> GivesPopper ()
            combine' :: GivesPopper () -> GivesPopper () -> GivesPopper ()
    combine' GivesPopper ()
    x GivesPopper ()
    y NeedsPopper ()
    f = GivesPopper ()
    x GivesPopper () -> GivesPopper ()
    forall a b. (a -> b) -> a -> b
    $ \IO ByteString
    x' -> GivesPopper ()
    y GivesPopper () -> GivesPopper ()
    forall a b. (a -> b) -> a -> b
    $ \IO ByteString
    y' -> IO ByteString -> IO ByteString -> GivesPopper ()
    combine'' IO ByteString
    x' IO ByteString
    y' NeedsPopper ()
    f

            combine'' :: Popper -> Popper -> NeedsPopper () -> IO ()
            combine'' :: IO ByteString -> IO ByteString -> GivesPopper ()
    combine'' IO ByteString
    x IO ByteString
    y NeedsPopper ()
    f = do
                istate <- Either (IO ByteString, IO ByteString) (IO ByteString)
    -> IO
         (IORef (Either (IO ByteString, IO ByteString) (IO ByteString)))
    forall a. a -> IO (IORef a)
    newIORef (Either (IO ByteString, IO ByteString) (IO ByteString)
     -> IO
          (IORef (Either (IO ByteString, IO ByteString) (IO ByteString))))
    -> Either (IO ByteString, IO ByteString) (IO ByteString)
    -> IO
         (IORef (Either (IO ByteString, IO ByteString) (IO ByteString)))
    forall a b. (a -> b) -> a -> b
    $ (IO ByteString, IO ByteString)
    -> Either (IO ByteString, IO ByteString) (IO ByteString)
    forall a b. a -> Either a b
    Left (IO ByteString
    x, IO ByteString
    y)
                f $ go istate

            go :: IORef (Either (IO ByteString, IO ByteString) (IO ByteString))
    -> IO ByteString
    go IORef (Either (IO ByteString, IO ByteString) (IO ByteString))
    istate = do
                state <- IORef (Either (IO ByteString, IO ByteString) (IO ByteString))
    -> IO (Either (IO ByteString, IO ByteString) (IO ByteString))
    forall a. IORef a -> IO a
    readIORef IORef (Either (IO ByteString, IO ByteString) (IO ByteString))
    istate
                case state of
                    Left (IO ByteString
    x, IO ByteString
    y) -> do
                        bs <- IO ByteString
    x
                        if S.null bs
                            then do
                                writeIORef istate $ Right y
                                y
                            else return bs
                    Right IO ByteString
    y -> IO ByteString
    y

    simplify :: RequestBody -> Either (Int64, Builder) (Maybe Int64, GivesPopper ())
    simplify :: RequestBody
    -> Either (Int64, Builder) (Maybe Int64, GivesPopper ())
    simplify (RequestBodyLBS ByteString
    lbs) = (Int64, Builder)
    -> Either (Int64, Builder) (Maybe Int64, GivesPopper ())
    forall a b. a -> Either a b
    Left (ByteString -> Int64
    L.length ByteString
    lbs, ByteString -> Builder
    fromLazyByteString ByteString
    lbs)
    simplify (RequestBodyBS ByteString
    bs) = (Int64, Builder)
    -> Either (Int64, Builder) (Maybe Int64, GivesPopper ())
    forall a b. a -> Either a b
    Left (Int -> Int64
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral (Int -> Int64) -> Int -> Int64
    forall a b. (a -> b) -> a -> b
    $ ByteString -> Int
    S.length ByteString
    bs, ByteString -> Builder
    fromByteString ByteString
    bs)
    simplify (RequestBodyBuilder Int64
    len Builder
    b) = (Int64, Builder)
    -> Either (Int64, Builder) (Maybe Int64, GivesPopper ())
    forall a b. a -> Either a b
    Left (Int64
    len, Builder
    b)
    simplify (RequestBodyStream Int64
    i GivesPopper ()
    gp) = (Maybe Int64, GivesPopper ())
    -> Either (Int64, Builder) (Maybe Int64, GivesPopper ())
    forall a b. b -> Either a b
    Right (Int64 -> Maybe Int64
    forall a. a -> Maybe a
    Just Int64
    i, GivesPopper ()
    gp)
    simplify (RequestBodyStreamChunked GivesPopper ()
    gp) = (Maybe Int64, GivesPopper ())
    -> Either (Int64, Builder) (Maybe Int64, GivesPopper ())
    forall a b. b -> Either a b
    Right (Maybe Int64
    forall a. Maybe a
    Nothing, GivesPopper ()
    gp)
    simplify (RequestBodyIO IO RequestBody
    _mbody) = String -> Either (Int64, Builder) (Maybe Int64, GivesPopper ())
    forall a. HasCallStack => String -> a
    error String
    "FIXME No support for Monoid on RequestBodyIO"

    builderToStream :: (Int64, Builder) -> (Maybe Int64, GivesPopper ())
    builderToStream :: (Int64, Builder) -> (Maybe Int64, GivesPopper ())
    builderToStream (Int64
    len, Builder
    builder) =
        (Int64 -> Maybe Int64
    forall a. a -> Maybe a
    Just Int64
    len, GivesPopper ()
    forall {b}. (IO ByteString -> IO b) -> IO b
    gp)
      where
        gp :: (IO ByteString -> IO b) -> IO b
    gp IO ByteString -> IO b
    np = do
            ibss <- [ByteString] -> IO (IORef [ByteString])
    forall a. a -> IO (IORef a)
    newIORef ([ByteString] -> IO (IORef [ByteString]))
    -> [ByteString] -> IO (IORef [ByteString])
    forall a b. (a -> b) -> a -> b
    $ ByteString -> [ByteString]
    L.toChunks (ByteString -> [ByteString]) -> ByteString -> [ByteString]
    forall a b. (a -> b) -> a -> b
    $ Builder -> ByteString
    toLazyByteString Builder
    builder
            np $ do
                bss <- readIORef ibss
                case bss of
                    [] -> ByteString -> IO ByteString
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ByteString
    S.empty
                    ByteString
    bs:[ByteString]
    bss' -> do
                        IORef [ByteString] -> [ByteString] -> IO ()
    forall a. IORef a -> a -> IO ()
    writeIORef IORef [ByteString]
    ibss [ByteString]
    bss'
                        ByteString -> IO ByteString
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ByteString
    bs

    -- | 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 Popper = IO S.ByteString

    -- | A function which must be provided with a 'Popper'.
    --
    -- Since 0.1.0
    type NeedsPopper a = Popper -> 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
    type GivesPopper a = NeedsPopper a -> IO a

    -- | 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
    data Request = Request
        { Request -> ByteString
    method :: Method
        -- ^ HTTP request method, eg GET, POST.
        --
        -- Since 0.1.0
        , Request -> Bool
    secure :: Bool
        -- ^ Whether to use HTTPS (ie, SSL).
        --
        -- Since 0.1.0
        , Request -> ByteString
    host :: S.ByteString
        -- ^ Requested host name, used for both the IP address to connect to and
        -- the @host@ request header.
        --
        -- This is in URI format, with raw IPv6 addresses enclosed in square brackets.
        -- Use 'strippedHostName' when making network connections.
        --
        -- Since 0.1.0
        , Request -> Int
    port :: Int
        -- ^ The port to connect to. Also used for generating the @host@ request header.
        --
        -- Since 0.1.0
        , Request -> ByteString
    path :: S.ByteString
        -- ^ Everything from the host to the query string.
        --
        -- Since 0.1.0
        , Request -> ByteString
    queryString :: S.ByteString
        -- ^ Query string appended to the path.
        --
        -- Since 0.1.0
        , Request -> RequestHeaders
    requestHeaders :: RequestHeaders
        -- ^ Custom HTTP request headers
        --
        -- The Content-Length and Transfer-Encoding headers are set automatically
        -- by this module, and shall not be added to @requestHeaders@.
        --
        -- If not provided by the user, @Host@ will automatically be set based on
        -- the @host@ and @port@ fields.
        --
        -- Moreover, the Accept-Encoding header is set implicitly to gzip for
        -- convenience by default. This behaviour can be overridden if needed, by
        -- setting the header explicitly to a different value. In order to omit the
        -- Accept-Header altogether, set it to the empty string \"\". If you need an
        -- empty Accept-Header (i.e. requesting the identity encoding), set it to a
        -- non-empty white-space string, e.g. \" \". See RFC 2616 section 14.3 for
        -- details about the semantics of the Accept-Header field. If you request a
        -- content-encoding not supported by this module, you will have to decode
        -- it yourself (see also the 'decompress' field).
        --
        -- Note: Multiple header fields with the same field-name will result in
        -- multiple header fields being sent and therefore it\'s the responsibility
        -- of the client code to ensure that the rules from RFC 2616 section 4.2
        -- are honoured.
        --
        -- Since 0.1.0
        , Request -> RequestBody
    requestBody :: RequestBody
        -- ^ Request body to be sent to the server.
        --
        -- Since 0.1.0
        , Request -> Maybe Proxy
    proxy :: Maybe Proxy
        -- ^ Optional HTTP proxy.
        --
        -- Since 0.1.0
        , Request -> Maybe HostAddress
    hostAddress :: Maybe HostAddress
        -- ^ Optional resolved host address. May not be used by all backends.
        --
        -- Since 0.1.0
        , Request -> Bool
    rawBody :: Bool
        -- ^ If @True@, a chunked and\/or gzipped body will not be
        -- decoded. Use with caution.
        --
        -- Since 0.1.0
        , Request -> ByteString -> Bool
    decompress :: S.ByteString -> Bool
        -- ^ Predicate to specify whether gzipped data should be
        -- decompressed on the fly (see 'alwaysDecompress' and
        -- 'browserDecompress'). Argument is the mime type.
        -- Default: browserDecompress.
        --
        -- Since 0.1.0
        , Request -> Int
    redirectCount :: Int
        -- ^ How many redirects to follow when getting a resource. 0 means follow
        -- no redirects. Default value: 10.
        --
        -- Since 0.1.0
        , Request -> Request -> Response (IO ByteString) -> IO ()
    checkResponse :: Request -> Response BodyReader -> IO ()
        -- ^ Check the response immediately after receiving the status and headers.
        -- This can be useful for throwing exceptions on non-success status codes.
        --
        -- In previous versions of http-client, this went under the name
        -- @checkStatus@, but was renamed to avoid confusion about the new default
        -- behavior (doing nothing).
        --
        -- @since 0.5.0
        , Request -> ResponseTimeout
    responseTimeout :: ResponseTimeout
        -- ^ Number of microseconds to wait for a response (see 'ResponseTimeout'
        -- for more information). Default: use 'managerResponseTimeout' (which by
        -- default is 30 seconds).
        --
        -- Since 0.1.0
        , Request -> Maybe CookieJar
    cookieJar :: Maybe CookieJar
        -- ^ A user-defined cookie jar.
        -- If 'Nothing', no cookie handling will take place, \"Cookie\" headers
        -- in 'requestHeaders' will be sent raw, and 'responseCookieJar' will be
        -- empty.
        --
        -- Since 0.1.0

        , Request -> HttpVersion
    requestVersion :: HttpVersion
        -- ^ HTTP version to send to server.
        --
        -- Default: HTTP 1.1
        --
        -- Since 0.4.3

        , Request -> SomeException -> IO ()
    onRequestBodyException :: SomeException -> IO ()
        -- ^ How to deal with exceptions thrown while sending the request.
        --
        -- Default: ignore @IOException@s, rethrow all other exceptions.
        --
        -- Since: 0.4.6

        , Request -> Maybe Manager
    requestManagerOverride :: Maybe Manager
        -- ^ A 'Manager' value that should override whatever @Manager@ value was
        -- passed in to the HTTP request function manually. This is useful when
        -- dealing with implicit global managers, such as in @Network.HTTP.Simple@
        --
        -- @since 0.4.28

        , Request -> HeaderName -> Bool
    shouldStripHeaderOnRedirect :: HeaderName -> Bool
        -- ^ Decide whether a header must be stripped from the request
        -- when following a redirect. Default: keep all headers intact.
        --
        -- @since 0.6.2

        , Request -> Bool
    shouldStripHeaderOnRedirectIfOnDifferentHostOnly :: Bool
        -- ^ Decide whether a header must be stripped from the request
        -- when following a redirect, if host differs from previous request
        -- in redirect chain. Default: false (always strip regardless of host change)
        --
        -- @since 0.7.15

        , Request -> ProxySecureMode
    proxySecureMode :: ProxySecureMode
        -- ^ How to proxy an HTTPS request.
        --
        -- Default: Use HTTP CONNECT.
        --
        -- @since 0.7.2

        , Request -> Set HeaderName
    redactHeaders :: Set.Set HeaderName
        -- ^ List of header values being redacted in case we show Request.
        --
        -- @since 0.7.13

        , Request -> RequestHeaders -> IO ()
    earlyHintHeadersReceived :: [Header] -> IO ()
        -- ^ Called every time an HTTP 103 Early Hints header section is received from the server.
        --
        -- @since 0.7.16
        }
        deriving T.Typeable

    -- | How to deal with timing out on retrieval of response headers.
    --
    -- @since 0.5.0
    data ResponseTimeout
        = ResponseTimeoutMicro !Int
        -- ^ Wait the given number of microseconds for response headers to
        -- load, then throw an exception
        | ResponseTimeoutNone
        -- ^ Wait indefinitely
        | ResponseTimeoutDefault
        -- ^ Fall back to the manager setting ('managerResponseTimeout') or, in its
        -- absence, Wait 30 seconds and then throw an exception.
        deriving (ResponseTimeout -> ResponseTimeout -> Bool
    (ResponseTimeout -> ResponseTimeout -> Bool)
    -> (ResponseTimeout -> ResponseTimeout -> Bool)
    -> Eq ResponseTimeout
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ResponseTimeout -> ResponseTimeout -> Bool
    == :: ResponseTimeout -> ResponseTimeout -> Bool
    $c/= :: ResponseTimeout -> ResponseTimeout -> Bool
    /= :: ResponseTimeout -> ResponseTimeout -> Bool
    Eq, Int -> ResponseTimeout -> ShowS
    [ResponseTimeout] -> ShowS
    ResponseTimeout -> String
    (Int -> ResponseTimeout -> ShowS)
    -> (ResponseTimeout -> String)
    -> ([ResponseTimeout] -> ShowS)
    -> Show ResponseTimeout
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> ResponseTimeout -> ShowS
    showsPrec :: Int -> ResponseTimeout -> ShowS
    $cshow :: ResponseTimeout -> String
    show :: ResponseTimeout -> String
    $cshowList :: [ResponseTimeout] -> ShowS
    showList :: [ResponseTimeout] -> ShowS
    Show)

    instance Show Request where
        show :: Request -> String
    show Request
    x = [String] -> String
    unlines
            [ String
    "Request {"
            , String
    "  host                 = " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ ByteString -> String
    forall a. Show a => a -> String
    show (Request -> ByteString
    host Request
    x)
            , String
    "  port                 = " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ Int -> String
    forall a. Show a => a -> String
    show (Request -> Int
    port Request
    x)
            , String
    "  secure               = " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ Bool -> String
    forall a. Show a => a -> String
    show (Request -> Bool
    secure Request
    x)
            , String
    "  requestHeaders       = " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ RequestHeaders -> String
    forall a. Show a => a -> String
    show (((HeaderName, ByteString) -> (HeaderName, ByteString))
    -> RequestHeaders -> RequestHeaders
    forall a b. (a -> b) -> [a] -> [b]
    DL.map (Set HeaderName
    -> (HeaderName, ByteString) -> (HeaderName, ByteString)
    redactSensitiveHeader (Set HeaderName
     -> (HeaderName, ByteString) -> (HeaderName, ByteString))
    -> Set HeaderName
    -> (HeaderName, ByteString)
    -> (HeaderName, ByteString)
    forall a b. (a -> b) -> a -> b
    $ Request -> Set HeaderName
    redactHeaders Request
    x) (Request -> RequestHeaders
    requestHeaders Request
    x))
            , String
    "  path                 = " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ ByteString -> String
    forall a. Show a => a -> String
    show (Request -> ByteString
    path Request
    x)
            , String
    "  queryString          = " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ ByteString -> String
    forall a. Show a => a -> String
    show (Request -> ByteString
    queryString Request
    x)
            --, "  requestBody          = " ++ show (requestBody x)
            , String
    "  method               = " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ ByteString -> String
    forall a. Show a => a -> String
    show (Request -> ByteString
    method Request
    x)
            , String
    "  proxy                = " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ Maybe Proxy -> String
    forall a. Show a => a -> String
    show (Request -> Maybe Proxy
    proxy Request
    x)
            , String
    "  rawBody              = " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ Bool -> String
    forall a. Show a => a -> String
    show (Request -> Bool
    rawBody Request
    x)
            , String
    "  redirectCount        = " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ Int -> String
    forall a. Show a => a -> String
    show (Request -> Int
    redirectCount Request
    x)
            , String
    "  responseTimeout      = " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ ResponseTimeout -> String
    forall a. Show a => a -> String
    show (Request -> ResponseTimeout
    responseTimeout Request
    x)
            , String
    "  requestVersion       = " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ HttpVersion -> String
    forall a. Show a => a -> String
    show (Request -> HttpVersion
    requestVersion Request
    x)
            , String
    "  proxySecureMode      = " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ ProxySecureMode -> String
    forall a. Show a => a -> String
    show (Request -> ProxySecureMode
    proxySecureMode Request
    x)
            , String
    "}"
            ]

    redactSensitiveHeader :: Set.Set HeaderName -> Header -> Header
    redactSensitiveHeader :: Set HeaderName
    -> (HeaderName, ByteString) -> (HeaderName, ByteString)
    redactSensitiveHeader Set HeaderName
    toRedact h :: (HeaderName, ByteString)
    h@(HeaderName
    name, ByteString
    _) =
      if HeaderName
    name HeaderName -> Set HeaderName -> Bool
    forall a. Ord a => a -> Set a -> Bool
    `Set.member` Set HeaderName
    toRedact
        then (HeaderName
    name, ByteString
    "<REDACTED>")
        else (HeaderName, ByteString)
    h

    -- | A simple representation of the HTTP response.
    --
    -- Since 0.1.0
    data Response body = Response
        { forall body. Response body -> Status
    responseStatus :: Status
        -- ^ Status code of the response.
        --
        -- Since 0.1.0
        , forall body. Response body -> HttpVersion
    responseVersion :: HttpVersion
        -- ^ HTTP version used by the server.
        --
        -- Since 0.1.0
        , forall body. Response body -> RequestHeaders
    responseHeaders :: ResponseHeaders
        -- ^ Response headers sent by the server.
        --
        -- Since 0.1.0
        , forall body. Response body -> body
    responseBody :: body
        -- ^ Response body sent by the server.
        --
        -- Since 0.1.0
        , forall body. Response body -> CookieJar
    responseCookieJar :: CookieJar
        -- ^ Cookies set on the client after interacting with the server. If
        -- cookies have been disabled by setting 'cookieJar' to @Nothing@, then
        -- this will always be empty.
        --
        -- Since 0.1.0
        , forall body. Response body -> ResponseClose
    responseClose' :: ResponseClose
        -- ^ Releases any resource held by this response. If the response body
        -- has not been fully read yet, doing so after this call will likely
        -- be impossible.
        --
        -- Since 0.1.0
        , forall body. Response body -> Request
    responseOriginalRequest :: Request
        -- ^ Holds original @Request@ related to this @Response@ (with an empty body).
        -- This field is intentionally not exported directly, but made available
        -- via @getOriginalRequest@ instead.
        --
        -- Since 0.7.8
        , forall body. Response body -> RequestHeaders
    responseEarlyHints :: ResponseHeaders
        -- ^ Early response headers sent by the server, as part of an HTTP
        -- 103 Early Hints section.
        --
        -- Since 0.7.16
        }
        deriving (Int -> Response body -> ShowS
    [Response body] -> ShowS
    Response body -> String
    (Int -> Response body -> ShowS)
    -> (Response body -> String)
    -> ([Response body] -> ShowS)
    -> Show (Response body)
    forall body. Show body => Int -> Response body -> ShowS
    forall body. Show body => [Response body] -> ShowS
    forall body. Show body => Response body -> String
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: forall body. Show body => Int -> Response body -> ShowS
    showsPrec :: Int -> Response body -> ShowS
    $cshow :: forall body. Show body => Response body -> String
    show :: Response body -> String
    $cshowList :: forall body. Show body => [Response body] -> ShowS
    showList :: [Response body] -> ShowS
    Show, T.Typeable, (forall a b. (a -> b) -> Response a -> Response b)
    -> (forall a b. a -> Response b -> Response a) -> Functor Response
    forall a b. a -> Response b -> Response a
    forall a b. (a -> b) -> Response a -> Response b
    forall (f :: * -> *).
    (forall a b. (a -> b) -> f a -> f b)
    -> (forall a b. a -> f b -> f a) -> Functor f
    $cfmap :: forall a b. (a -> b) -> Response a -> Response b
    fmap :: forall a b. (a -> b) -> Response a -> Response b
    $c<$ :: forall a b. a -> Response b -> Response a
    <$ :: forall a b. a -> Response b -> Response a
    Functor, (forall m. Monoid m => Response m -> m)
    -> (forall m a. Monoid m => (a -> m) -> Response a -> m)
    -> (forall m a. Monoid m => (a -> m) -> Response a -> m)
    -> (forall a b. (a -> b -> b) -> b -> Response a -> b)
    -> (forall a b. (a -> b -> b) -> b -> Response a -> b)
    -> (forall b a. (b -> a -> b) -> b -> Response a -> b)
    -> (forall b a. (b -> a -> b) -> b -> Response a -> b)
    -> (forall a. (a -> a -> a) -> Response a -> a)
    -> (forall a. (a -> a -> a) -> Response a -> a)
    -> (forall a. Response a -> [a])
    -> (forall a. Response a -> Bool)
    -> (forall a. Response a -> Int)
    -> (forall a. Eq a => a -> Response a -> Bool)
    -> (forall a. Ord a => Response a -> a)
    -> (forall a. Ord a => Response a -> a)
    -> (forall a. Num a => Response a -> a)
    -> (forall a. Num a => Response a -> a)
    -> Foldable Response
    forall a. Eq a => a -> Response a -> Bool
    forall a. Num a => Response a -> a
    forall a. Ord a => Response a -> a
    forall m. Monoid m => Response m -> m
    forall a. Response a -> Bool
    forall a. Response a -> Int
    forall a. Response a -> [a]
    forall a. (a -> a -> a) -> Response a -> a
    forall m a. Monoid m => (a -> m) -> Response a -> m
    forall b a. (b -> a -> b) -> b -> Response a -> b
    forall a b. (a -> b -> b) -> b -> Response a -> b
    forall (t :: * -> *).
    (forall m. Monoid m => t m -> m)
    -> (forall m a. Monoid m => (a -> m) -> t a -> m)
    -> (forall m a. Monoid m => (a -> m) -> t a -> m)
    -> (forall a b. (a -> b -> b) -> b -> t a -> b)
    -> (forall a b. (a -> b -> b) -> b -> t a -> b)
    -> (forall b a. (b -> a -> b) -> b -> t a -> b)
    -> (forall b a. (b -> a -> b) -> b -> t a -> b)
    -> (forall a. (a -> a -> a) -> t a -> a)
    -> (forall a. (a -> a -> a) -> t a -> a)
    -> (forall a. t a -> [a])
    -> (forall a. t a -> Bool)
    -> (forall a. t a -> Int)
    -> (forall a. Eq a => a -> t a -> Bool)
    -> (forall a. Ord a => t a -> a)
    -> (forall a. Ord a => t a -> a)
    -> (forall a. Num a => t a -> a)
    -> (forall a. Num a => t a -> a)
    -> Foldable t
    $cfold :: forall m. Monoid m => Response m -> m
    fold :: forall m. Monoid m => Response m -> m
    $cfoldMap :: forall m a. Monoid m => (a -> m) -> Response a -> m
    foldMap :: forall m a. Monoid m => (a -> m) -> Response a -> m
    $cfoldMap' :: forall m a. Monoid m => (a -> m) -> Response a -> m
    foldMap' :: forall m a. Monoid m => (a -> m) -> Response a -> m
    $cfoldr :: forall a b. (a -> b -> b) -> b -> Response a -> b
    foldr :: forall a b. (a -> b -> b) -> b -> Response a -> b
    $cfoldr' :: forall a b. (a -> b -> b) -> b -> Response a -> b
    foldr' :: forall a b. (a -> b -> b) -> b -> Response a -> b
    $cfoldl :: forall b a. (b -> a -> b) -> b -> Response a -> b
    foldl :: forall b a. (b -> a -> b) -> b -> Response a -> b
    $cfoldl' :: forall b a. (b -> a -> b) -> b -> Response a -> b
    foldl' :: forall b a. (b -> a -> b) -> b -> Response a -> b
    $cfoldr1 :: forall a. (a -> a -> a) -> Response a -> a
    foldr1 :: forall a. (a -> a -> a) -> Response a -> a
    $cfoldl1 :: forall a. (a -> a -> a) -> Response a -> a
    foldl1 :: forall a. (a -> a -> a) -> Response a -> a
    $ctoList :: forall a. Response a -> [a]
    toList :: forall a. Response a -> [a]
    $cnull :: forall a. Response a -> Bool
    null :: forall a. Response a -> Bool
    $clength :: forall a. Response a -> Int
    length :: forall a. Response a -> Int
    $celem :: forall a. Eq a => a -> Response a -> Bool
    elem :: forall a. Eq a => a -> Response a -> Bool
    $cmaximum :: forall a. Ord a => Response a -> a
    maximum :: forall a. Ord a => Response a -> a
    $cminimum :: forall a. Ord a => Response a -> a
    minimum :: forall a. Ord a => Response a -> a
    $csum :: forall a. Num a => Response a -> a
    sum :: forall a. Num a => Response a -> a
    $cproduct :: forall a. Num a => Response a -> a
    product :: forall a. Num a => Response a -> a
    Data.Foldable.Foldable, Functor Response
    Foldable Response
    (Functor Response, Foldable Response) =>
    (forall (f :: * -> *) a b.
     Applicative f =>
     (a -> f b) -> Response a -> f (Response b))
    -> (forall (f :: * -> *) a.
        Applicative f =>
        Response (f a) -> f (Response a))
    -> (forall (m :: * -> *) a b.
        Monad m =>
        (a -> m b) -> Response a -> m (Response b))
    -> (forall (m :: * -> *) a.
        Monad m =>
        Response (m a) -> m (Response a))
    -> Traversable Response
    forall (t :: * -> *).
    (Functor t, Foldable t) =>
    (forall (f :: * -> *) a b.
     Applicative f =>
     (a -> f b) -> t a -> f (t b))
    -> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
    -> (forall (m :: * -> *) a b.
        Monad m =>
        (a -> m b) -> t a -> m (t b))
    -> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
    -> Traversable t
    forall (m :: * -> *) a. Monad m => Response (m a) -> m (Response a)
    forall (f :: * -> *) a.
    Applicative f =>
    Response (f a) -> f (Response a)
    forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Response a -> m (Response b)
    forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Response a -> f (Response b)
    $ctraverse :: forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Response a -> f (Response b)
    traverse :: forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Response a -> f (Response b)
    $csequenceA :: forall (f :: * -> *) a.
    Applicative f =>
    Response (f a) -> f (Response a)
    sequenceA :: forall (f :: * -> *) a.
    Applicative f =>
    Response (f a) -> f (Response a)
    $cmapM :: forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Response a -> m (Response b)
    mapM :: forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Response a -> m (Response b)
    $csequence :: forall (m :: * -> *) a. Monad m => Response (m a) -> m (Response a)
    sequence :: forall (m :: * -> *) a. Monad m => Response (m a) -> m (Response a)
    Data.Traversable.Traversable)

    -- Purposely not providing this instance.  It used to use 'equivCookieJar'
    -- semantics before 0.7.0, but should, if anything, use 'equalCookieJar'
    -- semantics.
    --
    -- instance Exception Eq

    newtype ResponseClose = ResponseClose { ResponseClose -> IO ()
    runResponseClose :: IO () }
        deriving T.Typeable
    instance Show ResponseClose where
        show :: ResponseClose -> String
    show ResponseClose
    _ = String
    "ResponseClose"

    -- | 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 ManagerSettings = ManagerSettings
        { ManagerSettings -> Int
    managerConnCount :: Int
          -- ^ Number of connections to a single host to keep alive. Default: 10.
          --
          -- Since 0.1.0
        , ManagerSettings
    -> IO (Maybe HostAddress -> String -> Int -> IO Connection)
    managerRawConnection :: IO (Maybe NS.HostAddress -> String -> Int -> IO Connection)
          -- ^ Create an insecure connection.
          --
          -- Since 0.1.0
        , ManagerSettings
    -> IO (Maybe HostAddress -> String -> Int -> IO Connection)
    managerTlsConnection :: IO (Maybe NS.HostAddress -> String -> Int -> IO Connection)
          -- ^ Create a TLS connection. Default behavior: throw an exception that TLS is not supported.
          --
          -- Since 0.1.0
        , ManagerSettings
    -> IO
         (ByteString
          -> (Connection -> IO ())
          -> String
          -> Maybe HostAddress
          -> String
          -> Int
          -> IO Connection)
    managerTlsProxyConnection :: IO (S.ByteString -> (Connection -> IO ()) -> String -> Maybe NS.HostAddress -> String -> Int -> IO Connection)
          -- ^ Create a TLS proxy connection. Default behavior: throw an exception that TLS is not supported.
          --
          -- Since 0.2.2
        , ManagerSettings -> ResponseTimeout
    managerResponseTimeout :: ResponseTimeout
          -- ^ Default timeout to be applied to requests which do not provide a
          -- timeout value.
          --
          -- Default is 30 seconds
          --
          -- @since 0.5.0
        , ManagerSettings -> SomeException -> Bool
    managerRetryableException :: SomeException -> Bool
        -- ^ Exceptions for which we should retry our request if we were reusing an
        -- already open connection. In the case of IOExceptions, for example, we
        -- assume that the connection was closed on the server and therefore open a
        -- new one.
        --
        -- Since 0.1.0
        , ManagerSettings -> forall a. Request -> IO a -> IO a
    managerWrapException :: forall a. Request -> IO a -> IO a
        -- ^ Action wrapped around all attempted @Request@s, usually used to wrap
        -- up exceptions in library-specific types.
        --
        -- Default: wrap all @IOException@s in the @InternalException@ constructor.
        --
        -- @since 0.5.0
        , ManagerSettings -> Int
    managerIdleConnectionCount :: Int
        -- ^ Total number of idle connection to keep open at a given time.
        --
        -- This limit helps deal with the case where you are making a large number
        -- of connections to different hosts. Without this limit, you could run out
        -- of file descriptors. Additionally, it can be set to zero to prevent
        -- reuse of any connections. Doing this is useful when the server your application
        -- is talking to sits behind a load balancer.
        --
        -- Default: 512
        --
        -- Since 0.3.7
        , ManagerSettings -> Request -> IO Request
    managerModifyRequest :: Request -> IO Request
        -- ^ Perform the given modification to a @Request@ before performing it.
        --
        -- This function may be called more than once during request processing.
        -- see https://github.com/snoyberg/http-client/issues/350
        --
        -- Default: no modification
        --
        -- Since 0.4.4
        , ManagerSettings
    -> Response (IO ByteString) -> IO (Response (IO ByteString))
    managerModifyResponse :: Response BodyReader -> IO (Response BodyReader)
        -- ^ Perform the given modification to a @Response@ after receiving it.
        --
        -- Default: no modification
        --
        -- @since 0.5.5
        , ManagerSettings -> ProxyOverride
    managerProxyInsecure :: ProxyOverride
        -- ^ How HTTP proxy server settings should be discovered.
        --
        -- Default: respect the @proxy@ value on the @Request@ itself.
        --
        -- Since 0.4.7
        , ManagerSettings -> ProxyOverride
    managerProxySecure :: ProxyOverride
        -- ^ How HTTPS proxy server settings should be discovered.
        --
        -- Default: respect the @proxy@ value on the @Request@ itself.
        --
        -- Since 0.4.7
        , ManagerSettings -> Maybe MaxHeaderLength
    managerMaxHeaderLength :: Maybe MaxHeaderLength
        -- ^ Configure the maximum size, in bytes, of an HTTP header field.
        --
        -- Default: 4096
        --
        -- @since 0.7.17
        , ManagerSettings -> Maybe MaxNumberHeaders
    managerMaxNumberHeaders :: Maybe MaxNumberHeaders
        -- ^ Configure the maximum number of HTTP header fields.
        --
        -- Default: 100
        --
        -- @since 0.7.18
        }
        deriving T.Typeable

    -- | How the HTTP proxy server settings should be discovered.
    --
    -- Since 0.4.7
    newtype ProxyOverride = ProxyOverride
        { ProxyOverride -> Bool -> IO (Request -> Request)
    runProxyOverride :: Bool -> IO (Request -> Request)
        }
        deriving T.Typeable

    -- | 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
    data Manager = Manager
        { Manager -> KeyedPool ConnKey Connection
    mConns :: KeyedPool ConnKey Connection
        , Manager -> ResponseTimeout
    mResponseTimeout :: ResponseTimeout
        -- ^ Copied from 'managerResponseTimeout'
        , Manager -> SomeException -> Bool
    mRetryableException :: SomeException -> Bool
        , Manager -> forall a. Request -> IO a -> IO a
    mWrapException :: forall a. Request -> IO a -> IO a
        , Manager -> Request -> IO Request
    mModifyRequest :: Request -> IO Request
        , Manager -> Request -> Request
    mSetProxy :: Request -> Request
        , Manager
    -> Response (IO ByteString) -> IO (Response (IO ByteString))
    mModifyResponse :: Response BodyReader -> IO (Response BodyReader)
        -- ^ See 'managerProxy'
        , Manager -> Maybe MaxHeaderLength
    mMaxHeaderLength :: Maybe MaxHeaderLength
        , Manager -> Maybe MaxNumberHeaders
    mMaxNumberHeaders :: Maybe MaxNumberHeaders
        }
        deriving T.Typeable

    class HasHttpManager a where
        getHttpManager :: a -> Manager
    instance HasHttpManager Manager where
        getHttpManager :: Manager -> Manager
    getHttpManager = Manager -> Manager
    forall a. a -> a
    id

    data ConnsMap
        = ManagerClosed
        | ManagerOpen {-# UNPACK #-} !Int !(Map.Map ConnKey (NonEmptyList Connection))

    data NonEmptyList a =
        One a UTCTime |
        Cons a Int UTCTime (NonEmptyList a)
        deriving T.Typeable

    -- | Hostname or resolved host address.
    data ConnHost =
        HostName Text |
        HostAddress NS.HostAddress
        deriving (ConnHost -> ConnHost -> Bool
    (ConnHost -> ConnHost -> Bool)
    -> (ConnHost -> ConnHost -> Bool) -> Eq ConnHost
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ConnHost -> ConnHost -> Bool
    == :: ConnHost -> ConnHost -> Bool
    $c/= :: ConnHost -> ConnHost -> Bool
    /= :: ConnHost -> ConnHost -> Bool
    Eq, Int -> ConnHost -> ShowS
    [ConnHost] -> ShowS
    ConnHost -> String
    (Int -> ConnHost -> ShowS)
    -> (ConnHost -> String) -> ([ConnHost] -> ShowS) -> Show ConnHost
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> ConnHost -> ShowS
    showsPrec :: Int -> ConnHost -> ShowS
    $cshow :: ConnHost -> String
    show :: ConnHost -> String
    $cshowList :: [ConnHost] -> ShowS
    showList :: [ConnHost] -> ShowS
    Show, Eq ConnHost
    Eq ConnHost =>
    (ConnHost -> ConnHost -> Ordering)
    -> (ConnHost -> ConnHost -> Bool)
    -> (ConnHost -> ConnHost -> Bool)
    -> (ConnHost -> ConnHost -> Bool)
    -> (ConnHost -> ConnHost -> Bool)
    -> (ConnHost -> ConnHost -> ConnHost)
    -> (ConnHost -> ConnHost -> ConnHost)
    -> Ord ConnHost
    ConnHost -> ConnHost -> Bool
    ConnHost -> ConnHost -> Ordering
    ConnHost -> ConnHost -> ConnHost
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: ConnHost -> ConnHost -> Ordering
    compare :: ConnHost -> ConnHost -> Ordering
    $c< :: ConnHost -> ConnHost -> Bool
    < :: ConnHost -> ConnHost -> Bool
    $c<= :: ConnHost -> ConnHost -> Bool
    <= :: ConnHost -> ConnHost -> Bool
    $c> :: ConnHost -> ConnHost -> Bool
    > :: ConnHost -> ConnHost -> Bool
    $c>= :: ConnHost -> ConnHost -> Bool
    >= :: ConnHost -> ConnHost -> Bool
    $cmax :: ConnHost -> ConnHost -> ConnHost
    max :: ConnHost -> ConnHost -> ConnHost
    $cmin :: ConnHost -> ConnHost -> ConnHost
    min :: ConnHost -> ConnHost -> ConnHost
    Ord, T.Typeable)

    -- | @ConnKey@ consists of a hostname, a port and a @Bool@
    -- specifying whether to use SSL.
    data ConnKey
        = CKRaw (Maybe HostAddress) {-# UNPACK #-} !S.ByteString !Int
        | CKSecure (Maybe HostAddress) {-# UNPACK #-} !S.ByteString !Int
        | CKProxy
            {-# UNPACK #-} !S.ByteString
            !Int

            -- Proxy-Authorization request header
            (Maybe S.ByteString)

            -- ultimate host
            {-# UNPACK #-} !S.ByteString

            -- ultimate port
            !Int
        deriving (ConnKey -> ConnKey -> Bool
    (ConnKey -> ConnKey -> Bool)
    -> (ConnKey -> ConnKey -> Bool) -> Eq ConnKey
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ConnKey -> ConnKey -> Bool
    == :: ConnKey -> ConnKey -> Bool
    $c/= :: ConnKey -> ConnKey -> Bool
    /= :: ConnKey -> ConnKey -> Bool
    Eq, Int -> ConnKey -> ShowS
    [ConnKey] -> ShowS
    ConnKey -> String
    (Int -> ConnKey -> ShowS)
    -> (ConnKey -> String) -> ([ConnKey] -> ShowS) -> Show ConnKey
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> ConnKey -> ShowS
    showsPrec :: Int -> ConnKey -> ShowS
    $cshow :: ConnKey -> String
    show :: ConnKey -> String
    $cshowList :: [ConnKey] -> ShowS
    showList :: [ConnKey] -> ShowS
    Show, Eq ConnKey
    Eq ConnKey =>
    (ConnKey -> ConnKey -> Ordering)
    -> (ConnKey -> ConnKey -> Bool)
    -> (ConnKey -> ConnKey -> Bool)
    -> (ConnKey -> ConnKey -> Bool)
    -> (ConnKey -> ConnKey -> Bool)
    -> (ConnKey -> ConnKey -> ConnKey)
    -> (ConnKey -> ConnKey -> ConnKey)
    -> Ord ConnKey
    ConnKey -> ConnKey -> Bool
    ConnKey -> ConnKey -> Ordering
    ConnKey -> ConnKey -> ConnKey
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: ConnKey -> ConnKey -> Ordering
    compare :: ConnKey -> ConnKey -> Ordering
    $c< :: ConnKey -> ConnKey -> Bool
    < :: ConnKey -> ConnKey -> Bool
    $c<= :: ConnKey -> ConnKey -> Bool
    <= :: ConnKey -> ConnKey -> Bool
    $c> :: ConnKey -> ConnKey -> Bool
    > :: ConnKey -> ConnKey -> Bool
    $c>= :: ConnKey -> ConnKey -> Bool
    >= :: ConnKey -> ConnKey -> Bool
    $cmax :: ConnKey -> ConnKey -> ConnKey
    max :: ConnKey -> ConnKey -> ConnKey
    $cmin :: ConnKey -> ConnKey -> ConnKey
    min :: ConnKey -> ConnKey -> ConnKey
    Ord, T.Typeable)

    -- | Status of streaming a request body from a file.
    --
    -- Since 0.4.9
    data StreamFileStatus = StreamFileStatus
        { StreamFileStatus -> Int64
    fileSize :: Int64
        , StreamFileStatus -> Int64
    readSoFar :: Int64
        , StreamFileStatus -> Int
    thisChunkSize :: Int
        }
        deriving (StreamFileStatus -> StreamFileStatus -> Bool
    (StreamFileStatus -> StreamFileStatus -> Bool)
    -> (StreamFileStatus -> StreamFileStatus -> Bool)
    -> Eq StreamFileStatus
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: StreamFileStatus -> StreamFileStatus -> Bool
    == :: StreamFileStatus -> StreamFileStatus -> Bool
    $c/= :: StreamFileStatus -> StreamFileStatus -> Bool
    /= :: StreamFileStatus -> StreamFileStatus -> Bool
    Eq, Int -> StreamFileStatus -> ShowS
    [StreamFileStatus] -> ShowS
    StreamFileStatus -> String
    (Int -> StreamFileStatus -> ShowS)
    -> (StreamFileStatus -> String)
    -> ([StreamFileStatus] -> ShowS)
    -> Show StreamFileStatus
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> StreamFileStatus -> ShowS
    showsPrec :: Int -> StreamFileStatus -> ShowS
    $cshow :: StreamFileStatus -> String
    show :: StreamFileStatus -> String
    $cshowList :: [StreamFileStatus] -> ShowS
    showList :: [StreamFileStatus] -> ShowS
    Show, Eq StreamFileStatus
    Eq StreamFileStatus =>
    (StreamFileStatus -> StreamFileStatus -> Ordering)
    -> (StreamFileStatus -> StreamFileStatus -> Bool)
    -> (StreamFileStatus -> StreamFileStatus -> Bool)
    -> (StreamFileStatus -> StreamFileStatus -> Bool)
    -> (StreamFileStatus -> StreamFileStatus -> Bool)
    -> (StreamFileStatus -> StreamFileStatus -> StreamFileStatus)
    -> (StreamFileStatus -> StreamFileStatus -> StreamFileStatus)
    -> Ord StreamFileStatus
    StreamFileStatus -> StreamFileStatus -> Bool
    StreamFileStatus -> StreamFileStatus -> Ordering
    StreamFileStatus -> StreamFileStatus -> StreamFileStatus
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: StreamFileStatus -> StreamFileStatus -> Ordering
    compare :: StreamFileStatus -> StreamFileStatus -> Ordering
    $c< :: StreamFileStatus -> StreamFileStatus -> Bool
    < :: StreamFileStatus -> StreamFileStatus -> Bool
    $c<= :: StreamFileStatus -> StreamFileStatus -> Bool
    <= :: StreamFileStatus -> StreamFileStatus -> Bool
    $c> :: StreamFileStatus -> StreamFileStatus -> Bool
    > :: StreamFileStatus -> StreamFileStatus -> Bool
    $c>= :: StreamFileStatus -> StreamFileStatus -> Bool
    >= :: StreamFileStatus -> StreamFileStatus -> Bool
    $cmax :: StreamFileStatus -> StreamFileStatus -> StreamFileStatus
    max :: StreamFileStatus -> StreamFileStatus -> StreamFileStatus
    $cmin :: StreamFileStatus -> StreamFileStatus -> StreamFileStatus
    min :: StreamFileStatus -> StreamFileStatus -> StreamFileStatus
    Ord, T.Typeable)

    -- | The maximum header size in bytes.
    --
    -- @since 0.7.14
    newtype MaxHeaderLength = MaxHeaderLength
        { MaxHeaderLength -> Int
    unMaxHeaderLength :: Int
        }
        deriving (MaxHeaderLength -> MaxHeaderLength -> Bool
    (MaxHeaderLength -> MaxHeaderLength -> Bool)
    -> (MaxHeaderLength -> MaxHeaderLength -> Bool)
    -> Eq MaxHeaderLength
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: MaxHeaderLength -> MaxHeaderLength -> Bool
    == :: MaxHeaderLength -> MaxHeaderLength -> Bool
    $c/= :: MaxHeaderLength -> MaxHeaderLength -> Bool
    /= :: MaxHeaderLength -> MaxHeaderLength -> Bool
    Eq, Int -> MaxHeaderLength -> ShowS
    [MaxHeaderLength] -> ShowS
    MaxHeaderLength -> String
    (Int -> MaxHeaderLength -> ShowS)
    -> (MaxHeaderLength -> String)
    -> ([MaxHeaderLength] -> ShowS)
    -> Show MaxHeaderLength
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> MaxHeaderLength -> ShowS
    showsPrec :: Int -> MaxHeaderLength -> ShowS
    $cshow :: MaxHeaderLength -> String
    show :: MaxHeaderLength -> String
    $cshowList :: [MaxHeaderLength] -> ShowS
    showList :: [MaxHeaderLength] -> ShowS
    Show, Eq MaxHeaderLength
    Eq MaxHeaderLength =>
    (MaxHeaderLength -> MaxHeaderLength -> Ordering)
    -> (MaxHeaderLength -> MaxHeaderLength -> Bool)
    -> (MaxHeaderLength -> MaxHeaderLength -> Bool)
    -> (MaxHeaderLength -> MaxHeaderLength -> Bool)
    -> (MaxHeaderLength -> MaxHeaderLength -> Bool)
    -> (MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength)
    -> (MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength)
    -> Ord MaxHeaderLength
    MaxHeaderLength -> MaxHeaderLength -> Bool
    MaxHeaderLength -> MaxHeaderLength -> Ordering
    MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: MaxHeaderLength -> MaxHeaderLength -> Ordering
    compare :: MaxHeaderLength -> MaxHeaderLength -> Ordering
    $c< :: MaxHeaderLength -> MaxHeaderLength -> Bool
    < :: MaxHeaderLength -> MaxHeaderLength -> Bool
    $c<= :: MaxHeaderLength -> MaxHeaderLength -> Bool
    <= :: MaxHeaderLength -> MaxHeaderLength -> Bool
    $c> :: MaxHeaderLength -> MaxHeaderLength -> Bool
    > :: MaxHeaderLength -> MaxHeaderLength -> Bool
    $c>= :: MaxHeaderLength -> MaxHeaderLength -> Bool
    >= :: MaxHeaderLength -> MaxHeaderLength -> Bool
    $cmax :: MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength
    max :: MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength
    $cmin :: MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength
    min :: MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength
    Ord, Integer -> MaxHeaderLength
    MaxHeaderLength -> MaxHeaderLength
    MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength
    (MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength)
    -> (MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength)
    -> (MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength)
    -> (MaxHeaderLength -> MaxHeaderLength)
    -> (MaxHeaderLength -> MaxHeaderLength)
    -> (MaxHeaderLength -> MaxHeaderLength)
    -> (Integer -> MaxHeaderLength)
    -> Num MaxHeaderLength
    forall a.
    (a -> a -> a)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> (a -> a)
    -> (a -> a)
    -> (a -> a)
    -> (Integer -> a)
    -> Num a
    $c+ :: MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength
    + :: MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength
    $c- :: MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength
    - :: MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength
    $c* :: MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength
    * :: MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength
    $cnegate :: MaxHeaderLength -> MaxHeaderLength
    negate :: MaxHeaderLength -> MaxHeaderLength
    $cabs :: MaxHeaderLength -> MaxHeaderLength
    abs :: MaxHeaderLength -> MaxHeaderLength
    $csignum :: MaxHeaderLength -> MaxHeaderLength
    signum :: MaxHeaderLength -> MaxHeaderLength
    $cfromInteger :: Integer -> MaxHeaderLength
    fromInteger :: Integer -> MaxHeaderLength
    Num, Int -> MaxHeaderLength
    MaxHeaderLength -> Int
    MaxHeaderLength -> [MaxHeaderLength]
    MaxHeaderLength -> MaxHeaderLength
    MaxHeaderLength -> MaxHeaderLength -> [MaxHeaderLength]
    MaxHeaderLength
    -> MaxHeaderLength -> MaxHeaderLength -> [MaxHeaderLength]
    (MaxHeaderLength -> MaxHeaderLength)
    -> (MaxHeaderLength -> MaxHeaderLength)
    -> (Int -> MaxHeaderLength)
    -> (MaxHeaderLength -> Int)
    -> (MaxHeaderLength -> [MaxHeaderLength])
    -> (MaxHeaderLength -> MaxHeaderLength -> [MaxHeaderLength])
    -> (MaxHeaderLength -> MaxHeaderLength -> [MaxHeaderLength])
    -> (MaxHeaderLength
        -> MaxHeaderLength -> MaxHeaderLength -> [MaxHeaderLength])
    -> Enum MaxHeaderLength
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: MaxHeaderLength -> MaxHeaderLength
    succ :: MaxHeaderLength -> MaxHeaderLength
    $cpred :: MaxHeaderLength -> MaxHeaderLength
    pred :: MaxHeaderLength -> MaxHeaderLength
    $ctoEnum :: Int -> MaxHeaderLength
    toEnum :: Int -> MaxHeaderLength
    $cfromEnum :: MaxHeaderLength -> Int
    fromEnum :: MaxHeaderLength -> Int
    $cenumFrom :: MaxHeaderLength -> [MaxHeaderLength]
    enumFrom :: MaxHeaderLength -> [MaxHeaderLength]
    $cenumFromThen :: MaxHeaderLength -> MaxHeaderLength -> [MaxHeaderLength]
    enumFromThen :: MaxHeaderLength -> MaxHeaderLength -> [MaxHeaderLength]
    $cenumFromTo :: MaxHeaderLength -> MaxHeaderLength -> [MaxHeaderLength]
    enumFromTo :: MaxHeaderLength -> MaxHeaderLength -> [MaxHeaderLength]
    $cenumFromThenTo :: MaxHeaderLength
    -> MaxHeaderLength -> MaxHeaderLength -> [MaxHeaderLength]
    enumFromThenTo :: MaxHeaderLength
    -> MaxHeaderLength -> MaxHeaderLength -> [MaxHeaderLength]
    Enum, MaxHeaderLength
    MaxHeaderLength -> MaxHeaderLength -> Bounded MaxHeaderLength
    forall a. a -> a -> Bounded a
    $cminBound :: MaxHeaderLength
    minBound :: MaxHeaderLength
    $cmaxBound :: MaxHeaderLength
    maxBound :: MaxHeaderLength
    Bounded, T.Typeable)

    -- | The maximum number of header fields.
    --
    -- @since 0.7.18
    newtype MaxNumberHeaders = MaxNumberHeaders
        { MaxNumberHeaders -> Int
    unMaxNumberHeaders :: Int
        }
        deriving (MaxNumberHeaders -> MaxNumberHeaders -> Bool
    (MaxNumberHeaders -> MaxNumberHeaders -> Bool)
    -> (MaxNumberHeaders -> MaxNumberHeaders -> Bool)
    -> Eq MaxNumberHeaders
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: MaxNumberHeaders -> MaxNumberHeaders -> Bool
    == :: MaxNumberHeaders -> MaxNumberHeaders -> Bool
    $c/= :: MaxNumberHeaders -> MaxNumberHeaders -> Bool
    /= :: MaxNumberHeaders -> MaxNumberHeaders -> Bool
    Eq, Int -> MaxNumberHeaders -> ShowS
    [MaxNumberHeaders] -> ShowS
    MaxNumberHeaders -> String
    (Int -> MaxNumberHeaders -> ShowS)
    -> (MaxNumberHeaders -> String)
    -> ([MaxNumberHeaders] -> ShowS)
    -> Show MaxNumberHeaders
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> MaxNumberHeaders -> ShowS
    showsPrec :: Int -> MaxNumberHeaders -> ShowS
    $cshow :: MaxNumberHeaders -> String
    show :: MaxNumberHeaders -> String
    $cshowList :: [MaxNumberHeaders] -> ShowS
    showList :: [MaxNumberHeaders] -> ShowS
    Show, Eq MaxNumberHeaders
    Eq MaxNumberHeaders =>
    (MaxNumberHeaders -> MaxNumberHeaders -> Ordering)
    -> (MaxNumberHeaders -> MaxNumberHeaders -> Bool)
    -> (MaxNumberHeaders -> MaxNumberHeaders -> Bool)
    -> (MaxNumberHeaders -> MaxNumberHeaders -> Bool)
    -> (MaxNumberHeaders -> MaxNumberHeaders -> Bool)
    -> (MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders)
    -> (MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders)
    -> Ord MaxNumberHeaders
    MaxNumberHeaders -> MaxNumberHeaders -> Bool
    MaxNumberHeaders -> MaxNumberHeaders -> Ordering
    MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: MaxNumberHeaders -> MaxNumberHeaders -> Ordering
    compare :: MaxNumberHeaders -> MaxNumberHeaders -> Ordering
    $c< :: MaxNumberHeaders -> MaxNumberHeaders -> Bool
    < :: MaxNumberHeaders -> MaxNumberHeaders -> Bool
    $c<= :: MaxNumberHeaders -> MaxNumberHeaders -> Bool
    <= :: MaxNumberHeaders -> MaxNumberHeaders -> Bool
    $c> :: MaxNumberHeaders -> MaxNumberHeaders -> Bool
    > :: MaxNumberHeaders -> MaxNumberHeaders -> Bool
    $c>= :: MaxNumberHeaders -> MaxNumberHeaders -> Bool
    >= :: MaxNumberHeaders -> MaxNumberHeaders -> Bool
    $cmax :: MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders
    max :: MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders
    $cmin :: MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders
    min :: MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders
    Ord, Integer -> MaxNumberHeaders
    MaxNumberHeaders -> MaxNumberHeaders
    MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders
    (MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders)
    -> (MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders)
    -> (MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders)
    -> (MaxNumberHeaders -> MaxNumberHeaders)
    -> (MaxNumberHeaders -> MaxNumberHeaders)
    -> (MaxNumberHeaders -> MaxNumberHeaders)
    -> (Integer -> MaxNumberHeaders)
    -> Num MaxNumberHeaders
    forall a.
    (a -> a -> a)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> (a -> a)
    -> (a -> a)
    -> (a -> a)
    -> (Integer -> a)
    -> Num a
    $c+ :: MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders
    + :: MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders
    $c- :: MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders
    - :: MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders
    $c* :: MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders
    * :: MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders
    $cnegate :: MaxNumberHeaders -> MaxNumberHeaders
    negate :: MaxNumberHeaders -> MaxNumberHeaders
    $cabs :: MaxNumberHeaders -> MaxNumberHeaders
    abs :: MaxNumberHeaders -> MaxNumberHeaders
    $csignum :: MaxNumberHeaders -> MaxNumberHeaders
    signum :: MaxNumberHeaders -> MaxNumberHeaders
    $cfromInteger :: Integer -> MaxNumberHeaders
    fromInteger :: Integer -> MaxNumberHeaders
    Num, Int -> MaxNumberHeaders
    MaxNumberHeaders -> Int
    MaxNumberHeaders -> [MaxNumberHeaders]
    MaxNumberHeaders -> MaxNumberHeaders
    MaxNumberHeaders -> MaxNumberHeaders -> [MaxNumberHeaders]
    MaxNumberHeaders
    -> MaxNumberHeaders -> MaxNumberHeaders -> [MaxNumberHeaders]
    (MaxNumberHeaders -> MaxNumberHeaders)
    -> (MaxNumberHeaders -> MaxNumberHeaders)
    -> (Int -> MaxNumberHeaders)
    -> (MaxNumberHeaders -> Int)
    -> (MaxNumberHeaders -> [MaxNumberHeaders])
    -> (MaxNumberHeaders -> MaxNumberHeaders -> [MaxNumberHeaders])
    -> (MaxNumberHeaders -> MaxNumberHeaders -> [MaxNumberHeaders])
    -> (MaxNumberHeaders
        -> MaxNumberHeaders -> MaxNumberHeaders -> [MaxNumberHeaders])
    -> Enum MaxNumberHeaders
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: MaxNumberHeaders -> MaxNumberHeaders
    succ :: MaxNumberHeaders -> MaxNumberHeaders
    $cpred :: MaxNumberHeaders -> MaxNumberHeaders
    pred :: MaxNumberHeaders -> MaxNumberHeaders
    $ctoEnum :: Int -> MaxNumberHeaders
    toEnum :: Int -> MaxNumberHeaders
    $cfromEnum :: MaxNumberHeaders -> Int
    fromEnum :: MaxNumberHeaders -> Int
    $cenumFrom :: MaxNumberHeaders -> [MaxNumberHeaders]
    enumFrom :: MaxNumberHeaders -> [MaxNumberHeaders]
    $cenumFromThen :: MaxNumberHeaders -> MaxNumberHeaders -> [MaxNumberHeaders]
    enumFromThen :: MaxNumberHeaders -> MaxNumberHeaders -> [MaxNumberHeaders]
    $cenumFromTo :: MaxNumberHeaders -> MaxNumberHeaders -> [MaxNumberHeaders]
    enumFromTo :: MaxNumberHeaders -> MaxNumberHeaders -> [MaxNumberHeaders]
    $cenumFromThenTo :: MaxNumberHeaders
    -> MaxNumberHeaders -> MaxNumberHeaders -> [MaxNumberHeaders]
    enumFromThenTo :: MaxNumberHeaders
    -> MaxNumberHeaders -> MaxNumberHeaders -> [MaxNumberHeaders]
    Enum, MaxNumberHeaders
    MaxNumberHeaders -> MaxNumberHeaders -> Bounded MaxNumberHeaders
    forall a. a -> a -> Bounded a
    $cminBound :: MaxNumberHeaders
    minBound :: MaxNumberHeaders
    $cmaxBound :: MaxNumberHeaders
    maxBound :: MaxNumberHeaders
    Bounded, T.Typeable)