Harmonize MonadCont for Trace and Direct
treeowl opened this issue · comments
David Feuer commented
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:
-
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.
-
If GHC eventually offers more primitive support, the continuations may cease to be available, in which case the instances should go away.
David Feuer commented
@simonmar, any thoughts?
Simon Marlow commented
I have no strong opinions here.