Skip to content

feat: add Alternative instance for OptionT #4028

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

Closed
wants to merge 1 commit into from

Conversation

Kazark
Copy link

@Kazark Kazark commented Oct 26, 2021

I was working in OptionT and went to write a guard. I realized I had to do it in Option and then toOptionT[F], so I thought I would submit an Alternative instance for OptionT, since it already has Applicative and MonoidK.

I'm a n00b on how the layers of implicit resolution work, so I hope I have done that correctly. I'm very happy to take feedback on what I need to do differently here.

@LukaJCB
Copy link
Member

LukaJCB commented Oct 26, 2021

I think this instance was removed at some point because OptionT is not distributive. See this analogue ticket: purescript/purescript-transformers#116

@LukaJCB
Copy link
Member

LukaJCB commented Oct 26, 2021

Maybe the solution would be to have guard take only MonoidK and Applicative instead of Alternative?

@Kazark
Copy link
Author

Kazark commented Oct 26, 2021

I don't quite follow; is there a missing law? I assumed any issues would be caught by the laws.

@Kazark
Copy link
Author

Kazark commented Oct 26, 2021

Hm, read some more of that thread. Seems I've stumbled on a troubled edge case.

@Kazark Kazark closed this Oct 26, 2021
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