| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Network.TypedProtocol.ReqResp.Server
Synopsis
- data ReqRespServer req resp (m :: Type -> Type) a = ReqRespServer {
- recvMsgReq :: req -> m (resp, ReqRespServer req resp m a)
- recvMsgDone :: m a
- reqRespServerPeer :: forall (m :: Type -> Type) req resp a. Monad m => ReqRespServer req resp m a -> Server (ReqResp req resp) ('NonPipelined :: IsPipelined (ReqResp req resp)) ('StIdle :: ReqResp req resp) m a
- reqRespServerPeerLookahead :: forall resp m. Functor m => m resp -> ServerLookahead (ReqResp () resp) ('StIdle :: ReqResp () resp) m ()
- reqRespServerPeerLookaheadFixedSender :: forall resp m. Functor m => m resp -> ServerLookaheadFixedSender (ReqResp () resp) ('StIdle :: ReqResp () resp) m ()
Documentation
data ReqRespServer req resp (m :: Type -> Type) a Source #
Constructors
| ReqRespServer | |
Fields
| |
reqRespServerPeer :: forall (m :: Type -> Type) req resp a. Monad m => ReqRespServer req resp m a -> Server (ReqResp req resp) ('NonPipelined :: IsPipelined (ReqResp req resp)) ('StIdle :: ReqResp req resp) m a Source #
Interpret a particular server action sequence into the server side of the
ReqResp protocol.
reqRespServerPeerLookahead Source #
Arguments
| :: forall resp m. Functor m | |
| => m resp | produce (and record) the next reply |
| -> ServerLookahead (ReqResp () resp) ('StIdle :: ReqResp () resp) m () |
A lookahead ReqResp server (the dual of a pipelined client).
It is exactly reqRespServerPeerLookaheadFixedSender with its single
Sender plugged in at each AwaitLookahead (via
embedLookaheadUsingFixedSender), so the two never drift apart.
reqRespServerPeerLookaheadFixedSender Source #
Arguments
| :: forall resp m. Functor m | |
| => m resp | produce (and record) the next reply |
| -> ServerLookaheadFixedSender (ReqResp () resp) ('StIdle :: ReqResp () resp) m () |
A lookahead ReqResp server that receives requests ahead of sending their
replies: each AwaitLookahead hands the reply to the previous request off
to the sender thread (via TheSender, the one Sender carried by the
ServerLookaheadFixedSender wrapper — it runs nextResp, which typically
reads and advances some state), while immediately awaiting the next request.
The request payload is ignored (hence ()); replies come solely from
nextResp. This is the peer that
runLookaheadFixedSenderPeerWithDriver runs.