Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module provides facilities for adding headers to a response.
>>>
let headerVal = addHeader "some-url" 5 :: Headers '[Header "Location" String] Int
The value is added to the header specified by the type (Location
in the
example above).
- data Headers ls a = Headers {
- getResponse :: a
- getHeadersHList :: HList ls
- class AddHeader h v orig new | h v orig -> new, new -> h, new -> v, new -> orig where
- addHeader :: v -> orig -> new
- class BuildHeadersTo hs where
- buildHeadersTo :: [Header] -> HList hs
- class GetHeaders ls where
- getHeaders :: ls -> [Header]
- type family HeaderValMap f xs
- data HList a where
Documentation
Response Header objects. You should never need to construct one directly.
Instead, use addHeader
.
Headers | |
|
(KnownSymbol h, ToByteString v, (~) Bool (Contains h ((:) * fst rest)) False) => AddHeader Symbol h v (Headers ((:) * fst rest) a) (Headers ((:) * (Header h v) ((:) * fst rest)) a) Source | |
Functor (Headers ls) Source | |
(KnownSymbol h, GetHeaders (HList rest), ToByteString v) => GetHeaders (Headers ((:) * (Header h v) rest) a) Source | |
GetHeaders (Headers ([] *) a) Source |
class AddHeader h v orig new | h v orig -> new, new -> h, new -> v, new -> orig where Source
(KnownSymbol h, ToByteString v, (~) * new (Headers ((:) * (Header h v) ([] *)) a)) => AddHeader Symbol h v a new Source | |
(KnownSymbol h, ToByteString v, (~) Bool (Contains h ((:) * fst rest)) False) => AddHeader Symbol h v (Headers ((:) * fst rest) a) (Headers ((:) * (Header h v) ((:) * fst rest)) a) Source |
class BuildHeadersTo hs where Source
buildHeadersTo :: [Header] -> HList hs Source
Note: if there are multiple occurences of a header in the argument, the values are interspersed with commas before deserialization (see RFC2616 Sec 4.2)
BuildHeadersTo ([] *) Source | |
(FromByteString v, BuildHeadersTo xs, KnownSymbol h, (~) Bool (Contains h xs) False) => BuildHeadersTo ((:) * (Header h v) xs) Source |
class GetHeaders ls where Source
getHeaders :: ls -> [Header] Source
(KnownSymbol h, ToByteString x, GetHeaders (HList xs)) => GetHeaders (HList ((:) * (Header h x) xs)) Source | |
GetHeaders (HList ([] *)) Source | |
(KnownSymbol h, GetHeaders (HList rest), ToByteString v) => GetHeaders (Headers ((:) * (Header h v) rest) a) Source | |
GetHeaders (Headers ([] *) a) Source |
type family HeaderValMap f xs Source
HeaderValMap f [] = [] | |
HeaderValMap f (Header h x : xs) = Header h (f x) : HeaderValMap f xs |
(KnownSymbol h, ToByteString x, GetHeaders (HList xs)) => GetHeaders (HList ((:) * (Header h x) xs)) Source | |
GetHeaders (HList ([] *)) Source |