serv-0.1.0.0: Dependently typed API server framework

Safe HaskellSafe
LanguageHaskell2010

Serv.Internal.MediaType

Synopsis

Documentation

class HasMediaType ty where Source #

Minimal complete definition

mediaType

Methods

mediaType :: Proxy ty -> MediaType Source #

class HasMediaType ty => MimeEncode ty val where Source #

Minimal complete definition

mimeEncode

Methods

mimeEncode :: Proxy ty -> val -> ByteString Source #

class HasMediaType ty => MimeDecode ty val where Source #

Minimal complete definition

mimeDecode

Instances

negotiateContentAlways :: ReflectEncoders ctypes a => Proxy ctypes -> [Quality MediaType] -> a -> Maybe (MediaType, ByteString) Source #

Similar to negotiateContent but will always attempt to provide the first content type the server offers if nothing is acceptable. Still fails when no content types are offered (what's going on?)

class ReflectEncoders cts ty where Source #

Minimal complete definition

reflectEncoders

Methods

reflectEncoders :: Proxy cts -> [(MediaType, ty -> ByteString)] Source #

Instances

ReflectEncoders [k] ([] k) ty Source # 

Methods

reflectEncoders :: Proxy [k] ty -> [(MediaType, ty -> ByteString)] Source #

(ReflectEncoders [a] cts ty, MimeEncode a ct ty) => ReflectEncoders [a] ((:) a ct cts) ty Source # 

Methods

reflectEncoders :: Proxy ((a ': ct) cts) ty -> [(MediaType, ty -> ByteString)] Source #

class ReflectDecoders cts ty where Source #

Minimal complete definition

reflectDecoders

Instances

ReflectDecoders [k] ([] k) ty Source # 
(MimeDecode a ct ty, ReflectDecoders [a] cts ty) => ReflectDecoders [a] ((:) a ct cts) ty Source # 

Methods

reflectDecoders :: Proxy ((a ': ct) cts) ty -> [(MediaType, ByteString -> Either String ty)] Source #