serv-0.1.0.0: Dependently typed API server framework

Safe HaskellNone
LanguageHaskell2010

Serv.Internal.Header.Serialization

Synopsis

Documentation

class ReflectName n => HeaderEncode n a where Source #

Represents mechanisms to interpret data types as header-compatible values.

An instance of Encode n t captures a mechanism for treating values of type t as valid data to substantiate the header n.

Note: While this class allows the encoding of any value into a full Unicode Text value, Headers do not generally accept most Unicode code points. Be conservative in implementing this class.

Minimal complete definition

headerEncode

Methods

headerEncode :: Proxy n -> a -> Maybe Text Source #

Instances

ReflectName n => HeaderEncode n Text Source # 
ReflectName n => HeaderEncode n Int Source # 
ReflectName n => HeaderEncode n Bool Source # 
ReflectName n => HeaderEncode n RawText Source # 
HeaderEncode AccessControlAllowOrigin Text Source # 
HeaderEncode AccessControlMaxAge NominalDiffTime Source # 
HeaderEncode AccessControlAllowCredentials Bool Source # 
HeaderEncode h t => HeaderEncode h (Maybe t) Source # 
HeaderEncode AccessControlExposeHeaders (Set HeaderName) Source # 
HeaderEncode AccessControlAllowMethods [Verb] Source # 
HeaderEncode AccessControlAllowMethods (Set Verb) Source # 
HeaderEncode AccessControlAllowHeaders (Set HeaderName) Source # 
HeaderEncode Allow [Verb] Source # 
HeaderEncode Allow (Set Verb) Source # 

headerEncodeRaw :: HeaderEncode n a => Proxy n -> a -> Maybe ByteString Source #

Handles encoding a header all the way to raw bytes.

class ReflectName n => HeaderDecode n a where Source #

Represents mechanisms to interpret data types as header-compatible values.

An instance of Decode n t captures a mechanism for reading values of type t from header data stored at header n.

Minimal complete definition

headerDecode

headerDecodeRaw :: HeaderDecode n a => Proxy n -> Maybe ByteString -> Either String a Source #

Handles decoding a header all the way from raw bytes.