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
67
67
-- 'Network.TypedProtocol.Peer.Client' or 'Network.TypedProtocol.Peer.Server'
68
68
-- pattern synonyms provide this evidence automatically.
69
69
--
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__:
71
78
-- We are not exposing pipelined version, since it is not possible to write
72
79
-- a driver & proofs in a type safe which take into account the state when the
73
80
-- 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
79
79
-- "Network.TypedProtocol.Peer.Client" supply this evidence for you, and hence
80
80
-- are easier to use and let you avoid some kinds of type errors.
81
81
--
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
+ --
82
89
type Peer :: forall ps
83
90
-> PeerRole
84
91
-> IsPipelined
You can’t perform that action at this time.
0 commit comments