typed-protocols-examples-0.2.0.3: Examples and tests for the typed-protocols framework
Safe HaskellSafe-Inferred
LanguageHaskell2010

Network.TypedProtocol.ReqResp.Examples

Synopsis

Documentation

reqRespClient :: 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 :: 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. 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.