Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Header sym a
Documentation
Extract the given header's value as a value of type a
.
Example:
newtype Referer = Referer Text deriving (Eq, Show, FromText, ToText) -- GET /view-my-referer type MyApi = "view-my-referer" :> Header "from" Referer :> Get Referer
(KnownSymbol sym, FromText a, HasServer sublayout) => HasServer ((:>) * (Header Symbol * sym a) sublayout) | If you use All it asks is for a Example: newtype Referer = Referer Text deriving (Eq, Show, FromText, ToText) -- GET /view-my-referer type MyApi = "view-my-referer" :> Header "Referer" Referer :> Get Referer server :: Server MyApi server = viewReferer where viewReferer :: Referer -> EitherT (Int, String) IO referer viewReferer referer = return referer |
type Server ((:>) * (Header Symbol * sym a) sublayout) = Maybe a -> Server sublayout |