symantic-http-0.1.1.20190410: Symantic combinators for deriving clients or a server from an HTTP API

Safe HaskellNone
LanguageHaskell2010

Symantic.HTTP.MIME

Contents

Synopsis

Class MediaTypeFor

Type MediaType

Type MediaTypes

mediaTypes :: forall ts c. MimeTypes ts c => MediaTypes Source #

Type JSON

Type HTML

Type FormUrlEncoded

data FormUrlEncoded Source #

Instances
MediaTypeFor FormUrlEncoded Source # 
Instance details

Defined in Symantic.HTTP.MIME

FromForm a => MimeDecodable a FormUrlEncoded Source #

Web.urlDecodeAsForm Note that the mimeDecode p (mimeEncode p x) == Right x law only holds if every element of x is non-null (i.e., not ("", ""))

Instance details

Defined in Symantic.HTTP.MIME

ToForm a => MimeEncodable a FormUrlEncoded Source #

Web.urlEncodeAsForm Note that the mimeDecode p (mimeEncode p x) == Right x law only holds if every element of x is non-null (i.e., not ("", ""))

Instance details

Defined in Symantic.HTTP.MIME

Type OctetStream

Type PlainText

data PlainText Source #

Instances
MediaTypeFor PlainText Source # 
Instance details

Defined in Symantic.HTTP.MIME

MimeDecodable Int PlainText Source # 
Instance details

Defined in Symantic.HTTP.MIME

MimeDecodable () PlainText Source # 
Instance details

Defined in Symantic.HTTP.MIME

MimeDecodable Text PlainText Source # 
Instance details

Defined in Symantic.HTTP.MIME

MimeDecodable Text PlainText Source # 
Instance details

Defined in Symantic.HTTP.MIME

MimeDecodable String PlainText Source # 
Instance details

Defined in Symantic.HTTP.MIME

MimeEncodable Int PlainText Source # 
Instance details

Defined in Symantic.HTTP.MIME

MimeEncodable () PlainText Source # 
Instance details

Defined in Symantic.HTTP.MIME

MimeEncodable Text PlainText Source # 
Instance details

Defined in Symantic.HTTP.MIME

MimeEncodable Text PlainText Source # 
Instance details

Defined in Symantic.HTTP.MIME

MimeEncodable String PlainText Source #
BSL.fromStrict . T.encodeUtf8
Instance details

Defined in Symantic.HTTP.MIME

Type MimeType

data MimeType c where Source #

Existentially wraps a type-level type t with a proof it respects Constraint c. Usyally c is MimeEncodable a or MimeDecodable a.

Constructors

MimeType :: (c t, MediaTypeFor t) => Proxy t -> MimeType c 

mimeType :: forall t c. MediaTypeFor t => c t => MimeType c Source #

Type MimeTypeTs

mimeTypes :: forall ts c. MimeTypes ts c => NonEmpty (MimeType c) Source #

Class MimeTypes

class MimeTypes (ts :: [*]) (c :: * -> Constraint) where Source #

Implicitely generate MediaTypes and MimeTypes from given type-level list of types.

Instances
(MediaTypeFor t, MimeTypes (t1 ': ts) c, c t) => MimeTypes (t ': (t1 ': ts)) c Source #

More than one MimeType.

Instance details

Defined in Symantic.HTTP.MIME

(MediaTypeFor t, c t) => MimeTypes (t ': ([] :: [Type])) c Source #

Single MimeType.

Instance details

Defined in Symantic.HTTP.MIME

matchAccept :: forall ts c. MimeTypes ts c => ByteString -> Maybe (MimeType c) Source #

matchContent :: forall ts c. MimeTypes ts c => ByteString -> Maybe (MimeType c) Source #

Type MimeEncodable

class MediaTypeFor t => MimeEncodable a t where Source #

Instances
MimeEncodable Int PlainText Source # 
Instance details

Defined in Symantic.HTTP.MIME

MimeEncodable () PlainText Source # 
Instance details

Defined in Symantic.HTTP.MIME

ToForm a => MimeEncodable a FormUrlEncoded Source #

Web.urlEncodeAsForm Note that the mimeDecode p (mimeEncode p x) == Right x law only holds if every element of x is non-null (i.e., not ("", ""))

Instance details

Defined in Symantic.HTTP.MIME

MimeEncodable ByteString OctetStream Source # 
Instance details

Defined in Symantic.HTTP.MIME

MimeEncodable ByteString OctetStream Source # 
Instance details

Defined in Symantic.HTTP.MIME

MimeEncodable Text PlainText Source # 
Instance details

Defined in Symantic.HTTP.MIME

MimeEncodable Text PlainText Source # 
Instance details

Defined in Symantic.HTTP.MIME

MimeEncodable String PlainText Source #
BSL.fromStrict . T.encodeUtf8
Instance details

Defined in Symantic.HTTP.MIME

Type MimeEncoder

Type MimeDecodable

class MediaTypeFor mt => MimeDecodable a mt where Source #

Methods

mimeDecode :: Proxy mt -> MimeDecoder a Source #

Instances
MimeDecodable Int PlainText Source # 
Instance details

Defined in Symantic.HTTP.MIME

MimeDecodable () PlainText Source # 
Instance details

Defined in Symantic.HTTP.MIME

FromForm a => MimeDecodable a FormUrlEncoded Source #

Web.urlDecodeAsForm Note that the mimeDecode p (mimeEncode p x) == Right x law only holds if every element of x is non-null (i.e., not ("", ""))

Instance details

Defined in Symantic.HTTP.MIME

MimeDecodable ByteString OctetStream Source # 
Instance details

Defined in Symantic.HTTP.MIME

MimeDecodable ByteString OctetStream Source # 
Instance details

Defined in Symantic.HTTP.MIME

MimeDecodable Text PlainText Source # 
Instance details

Defined in Symantic.HTTP.MIME

MimeDecodable Text PlainText Source # 
Instance details

Defined in Symantic.HTTP.MIME

MimeDecodable String PlainText Source # 
Instance details

Defined in Symantic.HTTP.MIME

Type MimeDecoder