License | BSD3 |
---|---|
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
- data JSON
- data PlainText
- data HTML
- data OctetStream
- data MultipartFormData
- data UrlEncoded
- data Content ctypes a
- class Accept ctype where
- contentType :: Proxy ctype -> MediaType
- class Accept a => Encode a c where
- class Accept c => Decode c a where
- decode :: Proxy c -> ByteString -> Either String a
- class FromText a where
- class ToText a where
- class Encodings ctypes a where
- class Decodings ctypes a where
- class PartEncodings xs where
- partEncodings :: Proxy xs -> HListToRecTuple (StripContents xs) -> [[(MediaType, Builder)]]
- class PartDecodings xs where
- partDecodings :: Proxy xs -> [(ByteString, ByteString)] -> Either String (HListToRecTuple (StripContents xs))
- type family StripContents a :: [*]
Predefined Content Types.
Type representing content type of application/json
.
Type representing content type of text/plain
.
data OctetStream Source
Type representing content type of application/octetstream
.
data MultipartFormData Source
Type representing content type of multipart/form-data
.
data UrlEncoded Source
Type representing content type of application/x-www-form-urlencoded
.
Creating custom Content Types.
class Accept ctype where Source
Singleton class for content type.
contentType :: Proxy ctype -> MediaType Source
Converting from and to Text
Internal classes.
class PartEncodings xs where Source
partEncodings :: Proxy xs -> HListToRecTuple (StripContents xs) -> [[(MediaType, Builder)]] Source
PartEncodings ([] *) Source | |
(PartEncodings ts, Encodings ctypes (StripContent t), (~) * (MkContent t) (Content ctypes a)) => PartEncodings ((:) * t ts) Source |
class PartDecodings xs where Source
partDecodings :: Proxy xs -> [(ByteString, ByteString)] -> Either String (HListToRecTuple (StripContents xs)) Source
PartDecodings ([] *) Source | |
(PartDecodings ts, Decodings ctypes (StripContent t), (~) * (MkContent t) (Content ctypes a)) => PartDecodings ((:) * t ts) Source |
type family StripContents a :: [*] Source
StripContents (t : ts) = StripContent t : StripContents ts | |
StripContents `[]` = `[]` |