Skip to content

Conversation

@JordanMartinez
Copy link
Contributor

Fixes #232

b <- mb
unless b m

-- | `ap` provides a default implementation of `(<*>)` for any `Bind`, without
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“for any Monad”?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to update that.

unless b m

-- | `ap` provides a default implementation of `(<*>)` for any `Monad`, without
-- | using `(<*>)` as provided by the `Apply`-`Bind` superclass relationship.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bind -> Monad here too

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks for clarifying.

Copy link
Contributor Author

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.

@JordanMartinez JordanMartinez merged commit e7ce06a into purescript:master Oct 11, 2020
@JordanMartinez JordanMartinez deleted the fixLoop branch October 11, 2020 15:21
turlando pushed a commit to purescm/purescript-prelude that referenced this pull request Sep 3, 2021
* 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'
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

Successfully merging this pull request may close these issues.

Having ap depend on map can introduce loops

2 participants