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

Cofree monad and and applicative instances are inconsistent #36

Open
prophile opened this issue Dec 2, 2013 · 7 comments
Open

Cofree monad and and applicative instances are inconsistent #36

prophile opened this issue Dec 2, 2013 · 7 comments

Comments

@prophile
Copy link
Contributor

prophile commented Dec 2, 2013

pure and return have differing results. In the case of Cofree Maybe for instance, pure yields an infinite string of its argument, where as return yields a one-element string containing its argument.

@ekmett
Copy link
Owner

ekmett commented Dec 2, 2013

Ack. Then we need to change the Applicative to line up with the Monad.

@prophile
Copy link
Contributor Author

prophile commented Dec 2, 2013

That does mean adding an Alternative constraint on the functor to the Applicative instance.

@ekmett
Copy link
Owner

ekmett commented Dec 3, 2013

So be it. =) The existing Applicative I think was added without much thought.

@ekmett ekmett closed this as completed in ddae150 Dec 3, 2013
ekmett added a commit that referenced this issue Dec 3, 2013
Fix #36: Bring Applicative instance in line with Monad
@xuwei-k
Copy link

xuwei-k commented Dec 17, 2013

maybe Apply (Cofree f) is inconsistent too?

https://github.com/ekmett/free/blob/b229616f6/src/Control/Comonad/Cofree.hs#L149-L155

@ekmett
Copy link
Owner

ekmett commented Dec 17, 2013

Appears to be!

On Tue, Dec 17, 2013 at 12:57 AM, kenji yoshida [email protected]:

maybe Apply (Cofree f) is inconsistent too?

https://github.com/ekmett/free/blob/b229616f6/src/Control/Comonad/Cofree.hs#L149-L155


Reply to this email directly or view it on GitHubhttps://github.com//issues/36#issuecomment-30728047
.

@esoeylemez
Copy link

I'm currently working on a fix. I propose that we disconnect the comonadic and monadic branches of Cofree's logic. That implies that ComonadApply and Apply will disagree. Does anyone object to that?

@ekmett
Copy link
Owner

ekmett commented Sep 23, 2016

I very much do not like the idea of disconnecting the two sides of Cofree. I'm ambivalent about whether we rip out the "incidental" Monad instance, etc. or split it into separate types, but pretending the class hierarchy is unrelated isn't a solution I'd accept.

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

No branches or pull requests

4 participants