polysemy-http-0.13.1.0: Polysemy effects for HTTP clients
Safe HaskellNone
LanguageGHC2021

Polysemy.Http.Effect.Entity

Description

 
Synopsis

Documentation

data EntityError Source #

Generic error type for decoders.

Constructors

EntityError 

Fields

Instances

Instances details
Show EntityError Source # 
Instance details

Defined in Polysemy.Http.Effect.Entity

Eq EntityError Source # 
Instance details

Defined in Polysemy.Http.Effect.Entity

data EntityEncode d (a :: Type -> Type) b where Source #

Abstraction of json encoding, potentially usable for other content types like xml.

Constructors

EncodeLazy :: forall d (a :: Type -> Type). d -> EntityEncode d a ByteString 
EncodeStrict :: forall d (a :: Type -> Type). d -> EntityEncode d a ByteString 

encodeLazy :: forall d (r :: EffectRow). Member (EntityEncode d) r => d -> Sem r LByteString Source #

Lazily encode a value of type d to a LByteString

encodeStrict :: forall d (r :: EffectRow). Member (EntityEncode d) r => d -> Sem r ByteString Source #

Strictly encode a value of type d to a ByteString

encode :: forall d (r :: EffectRow). Member (EntityEncode d) r => d -> Sem r ByteString Source #

Strictly encode a value of type d to a ByteString

data EntityDecode d (a :: Type -> Type) b where Source #

Abstraction of json decoding, potentially usable for other content types like xml.

Constructors

DecodeLazy :: forall d (a :: Type -> Type). LByteString -> EntityDecode d a (Either EntityError d) 
DecodeStrict :: forall d (a :: Type -> Type). ByteString -> EntityDecode d a (Either EntityError d) 

decodeLazy :: forall d (r :: EffectRow). Member (EntityDecode d) r => LByteString -> Sem r (Either EntityError d) Source #

Lazily decode a LByteString to a value of type d

decodeStrict :: forall d (r :: EffectRow). Member (EntityDecode d) r => ByteString -> Sem r (Either EntityError d) Source #

Strictly decode a ByteString to a value of type d

decode :: forall d (r :: EffectRow). Member (EntityDecode d) r => ByteString -> Sem r (Either EntityError d) Source #

Strictly decode a ByteString to a value of type d

data Encode (a :: k) Source #

Marker type to be used with Entities

data Decode (a :: k) Source #

Marker type to be used with Entities

type family Entities (es :: [Type]) (r :: EffectRow) where ... Source #

Convenience constraint for requiring multiple entity effects, to be used like Members.

foo :: Entities [Encode Int, Decode Double] r => Sem r ()

Equations

Entities ('[] :: [Type]) _1 = () 
Entities (Encode d ': ds) r = (Member (EntityEncode d) r, Entities ds r) 
Entities (Decode d ': ds) r = (Member (EntityDecode d) r, Entities ds r) 

type family Encoders (es :: [Type]) (r :: EffectRow) where ... Source #

Convenience constraint for requiring multiple encoders.

foo :: Encoders [Int, Double] r => Sem r ()

Equations

Encoders ('[] :: [Type]) _1 = () 
Encoders (d ': ds) r = (Member (EntityEncode d) r, Encoders ds r) 

type family Decoders (ds :: [Type]) (r :: EffectRow) where ... Source #

Convenience constraint for requiring multiple decoders.

foo :: Decoders [Int, Double] r => Sem r ()

Equations

Decoders ('[] :: [Type]) _1 = () 
Decoders (d ': ds) r = (Member (EntityDecode d) r, Decoders ds r)