typed-protocols-examples-0.1.0.0: Examples and tests for the typed-protocols framework
Safe HaskellNone
LanguageHaskell2010

Network.TypedProtocol.ReqResp.Client

Synopsis

Normal client

data ReqRespClient req resp m a where Source #

Constructors

SendMsgReq :: req -> (resp -> m (ReqRespClient req resp m a)) -> ReqRespClient req resp m a 
SendMsgDone :: m a -> ReqRespClient req resp m a 

reqRespClientPeer :: Monad m => ReqRespClient req resp m a -> Peer (ReqResp req resp) AsClient StIdle m a Source #

Interpret a particular client action sequence into the client side of the ReqResp protocol.

Pipelined client

data ReqRespClientPipelined req resp m a where Source #

A request-response client designed for running the ReqResp protocol in a pipelined way.

Constructors

ReqRespClientPipelined :: ReqRespSender req resp Z c m a -> ReqRespClientPipelined req resp m a

A PingPongSender, but starting with zero outstanding pipelined responses, and for any internal collect type c.

data ReqRespSender req resp n c m a where Source #

Constructors

SendMsgReqPipelined :: req -> (resp -> m c) -> ReqRespSender req resp (S n) c m a -> ReqRespSender req resp n c m a

Send a Req message but alike in ReqRespClient do not await for the resopnse, instead supply a monadic action which will run on a received Pong message.

CollectPipelined :: Maybe (ReqRespSender req resp (S n) c m a) -> (c -> ReqRespSender req resp n c m a) -> ReqRespSender req resp (S n) c m a 
SendMsgDonePipelined :: a -> ReqRespSender req resp Z c m a

Termination of the req-resp protocol.

reqRespClientPeerPipelined :: Monad m => ReqRespClientPipelined req resp m a -> PeerPipelined (ReqResp req resp) AsClient StIdle m a Source #

Interpret a pipelined client as a PeerPipelined on the client side of the ReqResp protocol.