{-# LANGUAGE DeriveDataTypeable #-}
module Network.HTTP.Types.Version
(
HttpVersion(..)
, http09
, http10
, http11
, http20
)
where
import Data.Typeable
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
/= :: HttpVersion -> HttpVersion -> Bool
$c/= :: HttpVersion -> HttpVersion -> Bool
== :: HttpVersion -> HttpVersion -> Bool
$c== :: 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
min :: HttpVersion -> HttpVersion -> HttpVersion
$cmin :: HttpVersion -> HttpVersion -> HttpVersion
max :: HttpVersion -> HttpVersion -> HttpVersion
$cmax :: HttpVersion -> HttpVersion -> HttpVersion
>= :: HttpVersion -> HttpVersion -> Bool
$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
compare :: HttpVersion -> HttpVersion -> Ordering
$ccompare :: HttpVersion -> HttpVersion -> Ordering
$cp1Ord :: Eq HttpVersion
Ord, Typeable)
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
http09 :: HttpVersion
http09 :: HttpVersion
http09 = Int -> Int -> HttpVersion
HttpVersion Int
0 Int
9
http10 :: HttpVersion
http10 :: HttpVersion
http10 = Int -> Int -> HttpVersion
HttpVersion Int
1 Int
0
http11 :: HttpVersion
http11 :: HttpVersion
http11 = Int -> Int -> HttpVersion
HttpVersion Int
1 Int
1
http20 :: HttpVersion
http20 :: HttpVersion
http20 = Int -> Int -> HttpVersion
HttpVersion Int
2 Int
0