parallel icon indicating copy to clipboard operation
parallel copied to clipboard

Can an extra operation help explain things?

Open treeowl opened this issue 7 years ago • 1 comments

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.

treeowl avatar Jun 15 '18 22:06 treeowl

What things would this help explain? I feel like this doesn't add anything, runEval (f <$> m) is just as clear IMO.

konsumlamm avatar Jan 19 '24 19:01 konsumlamm