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

Fix #36 + add many useful instances #120

Closed
wants to merge 4 commits into from
Closed

Fix #36 + add many useful instances #120

wants to merge 4 commits into from

Conversation

esoeylemez
Copy link

See the commits for explanations.

The `shell.nix` file is locally useful for Nix-aided development.
Fixed `Cofree`'s `Apply` instance, made the `Monad` instance dependent
on `Plus` instead of `Alternative`, removed incorrect `MonadZip`
instance.

The `Plus`-based `Monad` instance allows using `Cofree` as a reentry
monad by allowing `Map`-like structures to record named reentry points.
`CofreeT` is a very useful monad transformer for actions that can set
named reentry labels.  This can be used, for example, for
continuation-based web frameworks, which is the motivation behind these
instances.
@ekmett
Copy link
Owner

ekmett commented Sep 23, 2016

Two major issues here:

First, I've generally tried to keep things so that instances for base classes incur base dependencies wherever possible. This would violate that guideline.

But, even if that wasn't a factor, there is a rather glaring oversight to be corrected here! (In my code, not yours.) The Monad instance for CofreeT actually needs to get removed entirely eventually, as it leads to an inconsistency with the Applicative and ComonadApply.

@ekmett ekmett closed this Sep 23, 2016
@ekmett
Copy link
Owner

ekmett commented Sep 23, 2016

Issue #36 talks about the problematic Monad for CofreeT.

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.

2 participants