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

Document reason for implementation choice for Monad (Yoneda m) #25

Open
treeowl opened this issue Feb 5, 2016 · 0 comments
Open

Document reason for implementation choice for Monad (Yoneda m) #25

treeowl opened this issue Feb 5, 2016 · 0 comments

Comments

@treeowl
Copy link
Contributor

treeowl commented Feb 5, 2016

Yoneda m >>= k = Yoneda (\f -> m id >>= \a -> runYoneda (k a) f)

I believe an alternative would be

Yoneda m >>= k = Yoneda (\f -> join . m $ \a -> runYoneda (k a) f)

The most obvious reason to prefer the current implementation is that it can take advantage of fmap id = id optimizations in some situations. Is this the only reason?

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

1 participant