ouroboros-network icon indicating copy to clipboard operation
ouroboros-network copied to clipboard

Clean protocols newtype wrapper usage

Open coot opened this issue 6 years ago • 0 comments
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)
     }

coot avatar Aug 21 '19 09:08 coot