Skip to content

Commit b23f327

Browse files
committed
typed-protocols: added haddocks
1 parent b3ba779 commit b23f327

File tree

1 file changed

+14
-1
lines changed
  • typed-protocols/src/Network/TypedProtocol

1 file changed

+14
-1
lines changed

typed-protocols/src/Network/TypedProtocol/Peer.hs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,14 @@ data Peer ps pr pl st m a where
227227
deriving instance Functor m => Functor (Peer ps pr pl st m)
228228

229229

230-
-- | Receiver
230+
-- | Receiver. It is limited to only awaiting for messages and running monadic
231+
-- computations. This means that on can only pipeline messages if they can be
232+
-- connected by state transitions which all have remote agency.
233+
--
234+
-- The receiver runs in parallel, see `runPipelinedPeerWithDriver`. This makes
235+
-- pipelining quite effective, since the receiver callbacks are called in
236+
-- a separate thread which can effectively use CPU cache.
237+
--
231238
type Receiver :: forall ps
232239
-> PeerRole
233240
-> ps
@@ -241,11 +248,17 @@ type Receiver :: forall ps
241248
-> Type
242249
data Receiver ps pr st stdone m c where
243250

251+
-- | Execute a monadic computation.
252+
--
244253
ReceiverEffect :: m (Receiver ps pr st stdone m c)
245254
-> Receiver ps pr st stdone m c
246255

256+
-- | Return value.
257+
--
247258
ReceiverDone :: c -> Receiver ps pr stdone stdone m c
248259

260+
-- | Await for for a remote transition.
261+
--
249262
ReceiverAwait :: ( StateTokenI st
250263
, ActiveState st
251264
)

0 commit comments

Comments
 (0)