-
Notifications
You must be signed in to change notification settings - Fork 91
Fix loop #233
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
Fix loop #233
Conversation
src/Control/Monad.purs
Outdated
@@ -64,3 +65,22 @@ unlessM :: forall m. Monad m => m Boolean -> m Unit -> m Unit | |||
unlessM mb m = do | |||
b <- mb | |||
unless b m | |||
|
|||
-- | `ap` provides a default implementation of `(<*>)` for any `Bind`, without |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“for any Monad”?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to update that.
src/Control/Monad.purs
Outdated
@@ -64,3 +65,22 @@ unlessM :: forall m. Monad m => m Boolean -> m Unit -> m Unit | |||
unlessM mb m = do | |||
b <- mb | |||
unless b m | |||
|
|||
-- | `ap` provides a default implementation of `(<*>)` for any `Monad`, without | |||
-- | using `(<*>)` as provided by the `Apply`-`Bind` superclass relationship. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bind -> Monad here too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? Isn't this specifically referring to Apply
and Bind
? Not Apply
and Monad
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this function has a Monad constraint. It's saying that while you could implement ap
by just writing ap = apply
(since the function has a Monad constraint, and Apply is one of Monad's superclasses), we don't, because we want people to be able to write apply = ap
in their Apply instances.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, thanks for clarifying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've fixed that in latest commits.
* Update Apply superclass law * Change ap constraint back to Monad * Port `ap` back to Monad * Reimplement `ap` using bind and pure * Document why revert was needed * Stop importing ap from Bind * Update purescript-psa to v0.8.0 * Update "for any Bind" to "for any Monad" * Update 'Apply - Bind' to 'Apply - Monad'
Fixes #232