typed-protocols-examples
Safe HaskellNone
LanguageHaskell2010

Network.TypedProtocol.Stateful.ReqResp.Codec

Synopsis

Documentation

data Some (f :: k -> Type) where Source #

Constructors

Some :: forall {k} (a :: k) (f :: k -> Type). Typeable a => f a -> Some f 

codecReqResp Source #

Arguments

:: forall req (m :: Type -> Type). Monad m 
=> (forall resp. req resp -> String)

encode `req resp`

-> (String -> Maybe (Some req))

decode `req resp`

-> (forall resp. req resp -> resp -> String)

encode resp

-> (forall resp. req resp -> String -> Maybe resp)

decode resp

-> Codec (ReqResp req) CodecFailure (State :: ReqResp req -> Type) m String 

Codec polymorphic in the RPC (e.g. req type)

data Bytes where Source #

Constructors

Bytes :: forall (st :: ReqResp FileAPI) (st' :: ReqResp FileAPI). Message (ReqResp FileAPI) st st' -> Bytes 

codecReqRespId :: forall (m :: Type -> Type). Applicative m => (forall res1 res2. (Typeable res1, Typeable res2) => Proxy res1 -> Proxy res2 -> Maybe (res1 :~: res2)) -> Codec FileRPC String (State :: ReqResp FileAPI -> Type) m Bytes Source #

An identity codec which wraps messages into AnyMessage.