monad-par icon indicating copy to clipboard operation
monad-par copied to clipboard

Harmonize MonadCont for Trace and Direct

Open treeowl opened this issue 7 years ago • 2 comments
trafficstars

Direct.Par has a MonadCont instance, while Trace.Par does not. Is there a reason for this? I think either both should or neither should. If we want to add one for Trace.Par, I believe it would look like this:

instance MonadCont Par where
  callCC f = Par $ \c -> case f (\a -> Par $ \_ -> c a) of Par q -> q c

I can see both sides:

  1. If these schedulers are committed to operating in the future as they do now, then continuations are available so we might as well expose them.

  2. If GHC eventually offers more primitive support, the continuations may cease to be available, in which case the instances should go away.

treeowl avatar Jul 05 '18 21:07 treeowl

@simonmar, any thoughts?

treeowl avatar Jul 18 '18 17:07 treeowl

I have no strong opinions here.

simonmar avatar Sep 17 '18 07:09 simonmar