Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can an extra operation help explain things? #39

Open
treeowl opened this issue Jun 15, 2018 · 1 comment
Open

Can an extra operation help explain things? #39

treeowl opened this issue Jun 15, 2018 · 1 comment

Comments

@treeowl
Copy link
Contributor

treeowl commented Jun 15, 2018

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.

@konsumlamm
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants