simonmar / monad-par

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Harmonize MonadCont for Trace and Direct

treeowl opened this issue · comments

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.

@simonmar, any thoughts?

I have no strong opinions here.