module Network.HTTP.Semantics.Header (
FieldName,
FieldValue,
TokenHeader,
TokenHeaderList,
TokenHeaderTable,
ValueTable,
getFieldValue,
HeaderTable,
HeaderValue,
getHeaderValue,
) where
import Data.Array (Array)
import Data.Array.Base (unsafeAt)
import Network.HTTP.Semantics.Token
import Data.ByteString (ByteString)
type FieldName = ByteString
type FieldValue = ByteString
{-# DEPRECATED HeaderValue "use FieldValue instead" #-}
type = ByteString
type ValueTable = Array Int (Maybe FieldValue)
{-# DEPRECATED HeaderTable "use TokenHeaderTable instead" #-}
type = (TokenHeaderList, ValueTable)
type = (TokenHeaderList, ValueTable)
type = (Token, FieldValue)
type = [TokenHeader]
{-# DEPRECATED getHeaderValue "use geFieldValue instead" #-}
{-# INLINE getHeaderValue #-}
getHeaderValue :: Token -> ValueTable -> Maybe FieldValue
Token
t ValueTable
tbl = ValueTable
tbl ValueTable -> Int -> Maybe FieldValue
forall i.
Ix i =>
Array i (Maybe FieldValue) -> Int -> Maybe FieldValue
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
a i e -> Int -> e
`unsafeAt` Token -> Int
tokenIx Token
t
{-# INLINE getFieldValue #-}
getFieldValue :: Token -> ValueTable -> Maybe FieldValue
getFieldValue :: Token -> ValueTable -> Maybe FieldValue
getFieldValue Token
t ValueTable
tbl = ValueTable
tbl ValueTable -> Int -> Maybe FieldValue
forall i.
Ix i =>
Array i (Maybe FieldValue) -> Int -> Maybe FieldValue
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
a i e -> Int -> e
`unsafeAt` Token -> Int
tokenIx Token
t