Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Serv.Internal.MediaType
- class HasMediaType ty where
- class HasMediaType ty => MimeEncode ty val where
- class HasMediaType ty => MimeDecode ty val where
- negotiateContent :: ReflectEncoders ctypes a => Proxy ctypes -> [Quality MediaType] -> a -> Maybe (MediaType, ByteString)
- negotiateContentAlways :: ReflectEncoders ctypes a => Proxy ctypes -> [Quality MediaType] -> a -> Maybe (MediaType, ByteString)
- class ReflectEncoders cts ty where
- tryDecode :: ReflectDecoders ctypes a => Proxy ctypes -> ByteString -> ByteString -> Maybe (Either String a)
- class ReflectDecoders cts ty where
Documentation
class HasMediaType ty => MimeEncode ty val where Source #
Minimal complete definition
Methods
mimeEncode :: Proxy ty -> val -> ByteString Source #
class HasMediaType ty => MimeDecode ty val where Source #
Minimal complete definition
Methods
mimeDecode :: Proxy ty -> ByteString -> Either String val Source #
negotiateContent :: ReflectEncoders ctypes a => Proxy ctypes -> [Quality MediaType] -> a -> Maybe (MediaType, ByteString) Source #
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
Methods
reflectEncoders :: Proxy cts -> [(MediaType, ty -> ByteString)] Source #
Instances
ReflectEncoders [k] ([] k) ty Source # | |
(ReflectEncoders [a] cts ty, MimeEncode a ct ty) => ReflectEncoders [a] ((:) a ct cts) ty Source # | |
tryDecode :: ReflectDecoders ctypes a => Proxy ctypes -> ByteString -> ByteString -> Maybe (Either String a) Source #
class ReflectDecoders cts ty where Source #
Minimal complete definition
Methods
reflectDecoders :: Proxy cts -> [(MediaType, ByteString -> Either String ty)] Source #
Instances
ReflectDecoders [k] ([] k) ty Source # | |
(MimeDecode a ct ty, ReflectDecoders [a] cts ty) => ReflectDecoders [a] ((:) a ct cts) ty Source # | |