-
Notifications
You must be signed in to change notification settings - Fork 29
MonadZero and MonadPlus seem redundant? #51
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
Comments
Hmm yeah, that does seem right! |
To add to that: it's not entirely clear to me that if we have |
I don't have a proof and maybe I'm wrong here, what is the case where |
This is why Maybe has MonadZero but not MonadPlus. |
Very interesting! Of course the above won't work for |
Yeah, I've verified that |
Oops, the |
I think you’re right about MonadZero: suppose F is a type constructor with valid Monad and Alternative instances. Now the type of its |
I'm going to close this, since the MonadPlus question appears resolved, and we can continue the discussion of what to do about MonadZero in #62. |
Given the laws of
Monad
that stateapply = ap
as well as the laws ofAlternative
that stateempty <*> f = empty
, we can practically derive theMonadZero
lawempty >>= f = empty
.Thus, it seems to me that we do not need to specify this law in addition to the laws already present.
Furthermore,
MonadPlus
has the requirement that>>=
distribute over<|>
. Though as it extendsAlternative
which already requires distribution of<*>
over<|>
and again, since<*> = ap
we already get that property. Am I missing something here?The text was updated successfully, but these errors were encountered: