    {-# LANGUAGE DeriveDataTypeable #-}
    {-# LANGUAGE DeriveGeneric #-}

    -- | Types and constants to describe the HTTP version.
    module Network.HTTP.Types.Version (
        HttpVersion (..),
        http09,
        http10,
        http11,
        http20,
    ) where

    import Data.Data (Data)
    import Data.Typeable (Typeable)
    import GHC.Generics (Generic)

    -- | HTTP Version.
    --
    -- Note that the 'Show' instance is intended merely for debugging.
    data HttpVersion = HttpVersion
        { HttpVersion -> Int
    httpMajor :: !Int
        , HttpVersion -> Int
    httpMinor :: !Int
        }
        deriving
            ( HttpVersion -> HttpVersion -> Bool
    (HttpVersion -> HttpVersion -> Bool)
    -> (HttpVersion -> HttpVersion -> Bool) -> Eq HttpVersion
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: HttpVersion -> HttpVersion -> Bool
    == :: HttpVersion -> HttpVersion -> Bool
    $c/= :: HttpVersion -> HttpVersion -> Bool
    /= :: HttpVersion -> HttpVersion -> Bool
    Eq
            , Eq HttpVersion
    Eq HttpVersion =>
    (HttpVersion -> HttpVersion -> Ordering)
    -> (HttpVersion -> HttpVersion -> Bool)
    -> (HttpVersion -> HttpVersion -> Bool)
    -> (HttpVersion -> HttpVersion -> Bool)
    -> (HttpVersion -> HttpVersion -> Bool)
    -> (HttpVersion -> HttpVersion -> HttpVersion)
    -> (HttpVersion -> HttpVersion -> HttpVersion)
    -> Ord HttpVersion
    HttpVersion -> HttpVersion -> Bool
    HttpVersion -> HttpVersion -> Ordering
    HttpVersion -> HttpVersion -> HttpVersion
    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 :: HttpVersion -> HttpVersion -> Ordering
    compare :: HttpVersion -> HttpVersion -> Ordering
    $c< :: HttpVersion -> HttpVersion -> Bool
    < :: HttpVersion -> HttpVersion -> Bool
    $c<= :: HttpVersion -> HttpVersion -> Bool
    <= :: HttpVersion -> HttpVersion -> Bool
    $c> :: HttpVersion -> HttpVersion -> Bool
    > :: HttpVersion -> HttpVersion -> Bool
    $c>= :: HttpVersion -> HttpVersion -> Bool
    >= :: HttpVersion -> HttpVersion -> Bool
    $cmax :: HttpVersion -> HttpVersion -> HttpVersion
    max :: HttpVersion -> HttpVersion -> HttpVersion
    $cmin :: HttpVersion -> HttpVersion -> HttpVersion
    min :: HttpVersion -> HttpVersion -> HttpVersion
    Ord
            , Typeable
            , -- | @since 0.12.4
              Typeable HttpVersion
    Typeable HttpVersion =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> HttpVersion -> c HttpVersion)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c HttpVersion)
    -> (HttpVersion -> Constr)
    -> (HttpVersion -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c HttpVersion))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c HttpVersion))
    -> ((forall b. Data b => b -> b) -> HttpVersion -> HttpVersion)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> HttpVersion -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> HttpVersion -> r)
    -> (forall u. (forall d. Data d => d -> u) -> HttpVersion -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> HttpVersion -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> HttpVersion -> m HttpVersion)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> HttpVersion -> m HttpVersion)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> HttpVersion -> m HttpVersion)
    -> Data HttpVersion
    HttpVersion -> Constr
    HttpVersion -> DataType
    (forall b. Data b => b -> b) -> HttpVersion -> HttpVersion
    forall a.
    Typeable a =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> HttpVersion -> u
    forall u. (forall d. Data d => d -> u) -> HttpVersion -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> HttpVersion -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> HttpVersion -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> HttpVersion -> m HttpVersion
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> HttpVersion -> m HttpVersion
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c HttpVersion
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> HttpVersion -> c HttpVersion
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c HttpVersion)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c HttpVersion)
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> HttpVersion -> c HttpVersion
    gfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> HttpVersion -> c HttpVersion
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c HttpVersion
    gunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c HttpVersion
    $ctoConstr :: HttpVersion -> Constr
    toConstr :: HttpVersion -> Constr
    $cdataTypeOf :: HttpVersion -> DataType
    dataTypeOf :: HttpVersion -> DataType
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c HttpVersion)
    dataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c HttpVersion)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c HttpVersion)
    dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c HttpVersion)
    $cgmapT :: (forall b. Data b => b -> b) -> HttpVersion -> HttpVersion
    gmapT :: (forall b. Data b => b -> b) -> HttpVersion -> HttpVersion
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> HttpVersion -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> HttpVersion -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> HttpVersion -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> HttpVersion -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> HttpVersion -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> HttpVersion -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> HttpVersion -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> HttpVersion -> u
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> HttpVersion -> m HttpVersion
    gmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> HttpVersion -> m HttpVersion
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> HttpVersion -> m HttpVersion
    gmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> HttpVersion -> m HttpVersion
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> HttpVersion -> m HttpVersion
    gmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> HttpVersion -> m HttpVersion
    Data
            , -- | @since 0.12.4
              (forall x. HttpVersion -> Rep HttpVersion x)
    -> (forall x. Rep HttpVersion x -> HttpVersion)
    -> Generic HttpVersion
    forall x. Rep HttpVersion x -> HttpVersion
    forall x. HttpVersion -> Rep HttpVersion x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. HttpVersion -> Rep HttpVersion x
    from :: forall x. HttpVersion -> Rep HttpVersion x
    $cto :: forall x. Rep HttpVersion x -> HttpVersion
    to :: forall x. Rep HttpVersion x -> HttpVersion
    Generic
            )

    -- | >>> show http11
    -- "HTTP/1.1"
    instance Show HttpVersion where
        show :: HttpVersion -> String
    show (HttpVersion Int
    major Int
    minor) = String
    "HTTP/" String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ Int -> String
    forall a. Show a => a -> String
    show Int
    major String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ String
    "." String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ Int -> String
    forall a. Show a => a -> String
    show Int
    minor

    -- | HTTP 0.9
    http09 :: HttpVersion
    http09 :: HttpVersion
    http09 = Int -> Int -> HttpVersion
    HttpVersion Int
    0 Int
    9

    -- | HTTP 1.0
    http10 :: HttpVersion
    http10 :: HttpVersion
    http10 = Int -> Int -> HttpVersion
    HttpVersion Int
    1 Int
    0

    -- | HTTP 1.1
    http11 :: HttpVersion
    http11 :: HttpVersion
    http11 = Int -> Int -> HttpVersion
    HttpVersion Int
    1 Int
    1

    -- | HTTP 2.0
    --
    -- @since 0.10
    http20 :: HttpVersion
    http20 :: HttpVersion
    http20 = Int -> Int -> HttpVersion
    HttpVersion Int
    2 Int
    0