typed-protocols-examples
Safe HaskellNone
LanguageHaskell2010

Network.TypedProtocol.ReqResp.Examples

Synopsis

Documentation

reqRespClient :: forall (m :: Type -> Type) req resp. Monad m => [req] -> ReqRespClient req resp m () Source #

An example request/response client which ignores received responses.

reqRespServerMapAccumL :: Monad m => (acc -> req -> m (acc, resp)) -> acc -> ReqRespServer req resp m acc Source #

A request/response server instance that computes a mapAccumL over the stream of requests.

reqRespClientMap :: forall (m :: Type -> Type) req resp. Monad m => [req] -> ReqRespClient req resp m [resp] Source #

An example request/response client that sends the given list of requests and collects the list of responses.

reqRespClientMapPipelined :: forall req resp (m :: Type -> Type). Monad m => [req] -> ReqRespClientPipelined req resp m [resp] Source #

An example request/response client that sends the given list of requests and collects the list of responses.

It is pipelined and tries to collect any replies if they are available. This allows pipelining but keeps it to a minimum, and correspondingly it gives maximum choice to the environment (drivers).

In theory, with enough and large enough requests and responses, this should be able to saturate any channel of any bandwidth and latency, because it should be able to have both peers send essentially continuously.