{-# options_haddock prune #-}
-- |Description: Header Data Types, Internal
module Polysemy.Http.Data.Header where

-- |The name of a header.
newtype HeaderName =
  HeaderName { HeaderName -> Text
unHeaderName :: Text }
  deriving (HeaderName -> HeaderName -> Bool
(HeaderName -> HeaderName -> Bool)
-> (HeaderName -> HeaderName -> Bool) -> Eq HeaderName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HeaderName -> HeaderName -> Bool
$c/= :: HeaderName -> HeaderName -> Bool
== :: HeaderName -> HeaderName -> Bool
$c== :: HeaderName -> HeaderName -> Bool
Eq, Int -> HeaderName -> ShowS
[HeaderName] -> ShowS
HeaderName -> String
(Int -> HeaderName -> ShowS)
-> (HeaderName -> String)
-> ([HeaderName] -> ShowS)
-> Show HeaderName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HeaderName] -> ShowS
$cshowList :: [HeaderName] -> ShowS
show :: HeaderName -> String
$cshow :: HeaderName -> String
showsPrec :: Int -> HeaderName -> ShowS
$cshowsPrec :: Int -> HeaderName -> ShowS
Show, (forall x. HeaderName -> Rep HeaderName x)
-> (forall x. Rep HeaderName x -> HeaderName) -> Generic HeaderName
forall x. Rep HeaderName x -> HeaderName
forall x. HeaderName -> Rep HeaderName x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HeaderName x -> HeaderName
$cfrom :: forall x. HeaderName -> Rep HeaderName x
Generic)
  deriving newtype (String -> HeaderName
(String -> HeaderName) -> IsString HeaderName
forall a. (String -> a) -> IsString a
fromString :: String -> HeaderName
$cfromString :: String -> HeaderName
IsString)

defaultJson ''HeaderName

-- |The value of a header.
newtype HeaderValue =
  HeaderValue { HeaderValue -> Text
unHeaderValue :: Text }
  deriving (HeaderValue -> HeaderValue -> Bool
(HeaderValue -> HeaderValue -> Bool)
-> (HeaderValue -> HeaderValue -> Bool) -> Eq HeaderValue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HeaderValue -> HeaderValue -> Bool
$c/= :: HeaderValue -> HeaderValue -> Bool
== :: HeaderValue -> HeaderValue -> Bool
$c== :: HeaderValue -> HeaderValue -> Bool
Eq, Int -> HeaderValue -> ShowS
[HeaderValue] -> ShowS
HeaderValue -> String
(Int -> HeaderValue -> ShowS)
-> (HeaderValue -> String)
-> ([HeaderValue] -> ShowS)
-> Show HeaderValue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HeaderValue] -> ShowS
$cshowList :: [HeaderValue] -> ShowS
show :: HeaderValue -> String
$cshow :: HeaderValue -> String
showsPrec :: Int -> HeaderValue -> ShowS
$cshowsPrec :: Int -> HeaderValue -> ShowS
Show, (forall x. HeaderValue -> Rep HeaderValue x)
-> (forall x. Rep HeaderValue x -> HeaderValue)
-> Generic HeaderValue
forall x. Rep HeaderValue x -> HeaderValue
forall x. HeaderValue -> Rep HeaderValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HeaderValue x -> HeaderValue
$cfrom :: forall x. HeaderValue -> Rep HeaderValue x
Generic)
  deriving newtype (String -> HeaderValue
(String -> HeaderValue) -> IsString HeaderValue
forall a. (String -> a) -> IsString a
fromString :: String -> HeaderValue
$cfromString :: String -> HeaderValue
IsString)

defaultJson ''HeaderValue

-- |An HTTP header.
data Header =
  Header {
    Header -> HeaderName
name :: HeaderName,
    Header -> HeaderValue
value :: HeaderValue
  }
  deriving (Header -> Header -> Bool
(Header -> Header -> Bool)
-> (Header -> Header -> Bool) -> Eq Header
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Header -> Header -> Bool
$c/= :: Header -> Header -> Bool
== :: Header -> Header -> Bool
$c== :: Header -> Header -> Bool
Eq, Int -> Header -> ShowS
[Header] -> ShowS
Header -> String
(Int -> Header -> ShowS)
-> (Header -> String) -> ([Header] -> ShowS) -> Show Header
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Header] -> ShowS
$cshowList :: [Header] -> ShowS
show :: Header -> String
$cshow :: Header -> String
showsPrec :: Int -> Header -> ShowS
$cshowsPrec :: Int -> Header -> ShowS
Show, (forall x. Header -> Rep Header x)
-> (forall x. Rep Header x -> Header) -> Generic Header
forall x. Rep Header x -> Header
forall x. Header -> Rep Header x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Header x -> Header
$cfrom :: forall x. Header -> Rep Header x
Generic)

defaultJson ''Header