Skip to content

Relax instance requirements for bind/monad #48

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

Merged
merged 2 commits into from
May 22, 2016

Conversation

parsonsmatt
Copy link
Contributor

For Cofree f to be a monad, you only need Alternative, not MonadPlus. From hackage:

Furthermore, if the functor f forms a monoid (for example, by being an instance of Alternative), the resulting Comonad is also a Monad. See Monadic Augment and Generalised Shortcut Fusion by Neil Ghani et al., Section 4.3 for more details.

The implementation of pure is an infinite loop. This PR also addresses that, and includes an Alternative requirement on the Applicative instance.

@parsonsmatt parsonsmatt changed the title Relax instance requirements for extend/monad Relax instance requirements for bind/monad Apr 11, 2016
@paf31
Copy link
Contributor

paf31 commented May 22, 2016

@garyb Can we merge this for 1.0 please? The Applicative instance which is there now actually looks wrong.

@garyb
Copy link
Member

garyb commented May 22, 2016

Sure thing, not sure how I missed this.

@garyb garyb merged commit f8ab7c5 into purescript:master May 22, 2016
@parsonsmatt
Copy link
Contributor Author

Thanks! 😄

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.

3 participants