parallel
parallel copied to clipboard
Can an extra operation help explain things?
appEval :: forall a (b :: TYPE rep).
(a -> b) -> Eval a -> b
appEval f (Eval (IO m)) =
case runRW# m of
(# _, a #) -> f a
Ignoring levity polymorphism, this could be implemented
appEval f m = runEval (f <$> m)
Moreover,
runEval = appEval id
But what makes this interesting, I think, is its relationship with >>=: aside from arity wibbles,
m >>= f = appEval f m
This strikes me as a really pleasant property.
What things would this help explain? I feel like this doesn't add anything, runEval (f <$> m) is just as clear IMO.