ouroboros-network
ouroboros-network copied to clipboard
Clean protocols newtype wrapper usage
trafficstars
We should:
- keep the top level wrappers, e.g.
newtype ChainSyncClient ... = ChainSyncClient (m ClientStIdle ... - but avoid them in callbacks
This way we can keep the right emphasis of what is the top level API, but avoid indirection in various places, e.g.
data ClientStNext header point m a =
ClientStNext {
recvMsgRollForward :: header -> point -> ChainSyncClient header point m a,
recvMsgRollBackward :: point -> point -> ChainSyncClient header point m a
}
should be:
data ClientStNext header point m a =
ClientStNext {
recvMsgRollForward :: header -> point -> m (ClientStIdle header point m a),
recvMsgRollBackward :: point -> point -> m (ClientStIdle header point m a)
}