-
Notifications
You must be signed in to change notification settings - Fork 0
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
IO's Alternative, MonadPlus, and MonadFail instances leak exceptions #1
Comments
IO
's MonadPlus and MonadFail instances leak exceptions
IO
's MonadPlus and MonadFail instances leak exceptions
Seems like you could write:
That may work to propagate the constraints. These would overlap any instance that delegated transparently to the underlying monad. |
Interesting idea. But it doesn't deal with transformer stacks over |
Okay, I played around with things. But that said, there might be some advanced overlapping techniques to get around that involving functional dependencies (like the first option here). Still, I'm apprehensive about this approach in light of transformer stacks. At the least, I'll put in a warning in the docs being really clear about the I'm interested in your thoughts on all this. We didn't talk about it yet, but I don't think dropping the instances of |
I could remove the
MonadFail
instance fromChecked
, butMonadPlus
andAlternative
are unfortunate to remove. Really, the problem isn't these type classes. The problem is thatIO
throws exceptions in the instances for these type classes.So maybe for
IO
, I should make a newtype. If you useIO
directly, then the warning is merely not to callmzero
orfail
. But if you use the newtype I provide forIO
, then you're safer, because I won't expose exception-throwing instances for any type classes.The text was updated successfully, but these errors were encountered: