File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
typed-protocols-stateful/src/Network/TypedProtocol/Stateful
typed-protocols/src/Network/TypedProtocol Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,14 @@ import Network.TypedProtocol.Core as Core
6767-- 'Network.TypedProtocol.Peer.Client' or 'Network.TypedProtocol.Peer.Server'
6868-- pattern synonyms provide this evidence automatically.
6969--
70- -- TODO:
70+ -- __NOTE__:
71+ -- one should not allocate resources within a `Peer` since there's no way to
72+ -- safely clean-up resources in case of an asynchronous exception. The proper
73+ -- way to allocate resources is to call
74+ -- `Network.TypedProtocol.Stateful.Driver.runPeerWithDriver` within
75+ -- a `Control.Exception.bracket`.
76+ --
77+ -- __TODO__:
7178-- We are not exposing pipelined version, since it is not possible to write
7279-- a driver & proofs in a type safe which take into account the state when the
7380-- peer type only tracks depth of pipelining rather than pipelined transitions.
Original file line number Diff line number Diff line change @@ -79,6 +79,13 @@ import Network.TypedProtocol.Core as Core
7979-- "Network.TypedProtocol.Peer.Client" supply this evidence for you, and hence
8080-- are easier to use and let you avoid some kinds of type errors.
8181--
82+ -- __NOTE__:
83+ -- one should not allocate resources within a `Peer` since there's no way to
84+ -- safely clean-up resources in case of an asynchronous exception. The proper
85+ -- way to allocate resources is to call
86+ -- `Network.TypedProtocol.Driver.runPeerWithDriver` (or `runPeer`,
87+ -- `runPipelinedPeer`) within a `Control.Exception.bracket`.
88+ --
8289type Peer :: forall ps
8390 -> PeerRole
8491 -> IsPipelined
You can’t perform that action at this time.
0 commit comments