Module
Type.Trout.ContentType
- Package
- purescript-trout
- Repository
- owickstrom/purescript-trout
#HasMediaType Source
class HasMediaType ct where
Associates a media type to a Trout content type.
Members
getMediaType :: Proxy ct -> MediaType
#MimeRender Source
class MimeRender a ct b | a -> b, ct -> b where
Renders a value of type a
, as appropriate for content type ct
, as
a value of type b
.
Members
mimeRender :: Proxy ct -> a -> b
#AllMimeRender Source
class AllMimeRender a cts b | a -> b, cts -> b where
Renders a value of type a
, as appropriate for each content type in cts
,
as a non-empty list of values of type b
, corresponding to the content
types. Content types can be a single type, e.g. HTML
, or multiple types
separated by :<|>
, e.g. (HTML :<|> JSON)
.
This is used to support content negotiation.
Members
allMimeRender :: Proxy cts -> a -> NonEmptyList (Tuple MediaType b)
Instances
(MimeRender a ct1 b, HasMediaType ct1, AllMimeRender a (Alt ct2 ct3) b, HasMediaType ct2) => AllMimeRender a (Alt ct1 (Alt ct2 ct3)) b
(MimeRender a ct1 b, HasMediaType ct1, MimeRender a ct2 b, HasMediaType ct2) => AllMimeRender a (Alt ct1 ct2) b