-
Notifications
You must be signed in to change notification settings - Fork 71
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
Generalize the base monad of fold-like operations #195
base: master
Are you sure you want to change the base?
Conversation
5a418fc
to
39e9789
Compare
Previously the fold-like operations were restricted to fold operations in `IO`, greatly limiting their usefulness. Here we generalize them to any `MonadMask`, provided by the widely-used `exceptions` library. Resolves lpsmith#9.
39e9789
to
ec37888
Compare
Ping. |
Ahh yes, sorry for not taking a peek at this a bit sooner. Nothing too wrong with this patch in principle, but in practice, IIRC, the In any case, I have finally come to the point of view that the |
Can you be more specific? I never quite understood what the objection to |
Also prevents spurious rebuilds with current cabal versions.
The problem with However, it is only relevant for Edit: Above also applies to folds, with current api you can't exit from fold early without exceptions anyway. And there is a valid criticism of MonadBaseControl being tricky. Writing instances for it is not that trivial either. I think that going the exceptions route would be better for most of |
Any chance of this getting in? I got the impression that the general problem with short-circuiting monads like OTOH, I think I class like MonadBracket might work? Unfortunately, it seems MonadBracket hasn't actually been published as a separate library, though it seems to be included in (FWIW, it seems to me that MonadBracket actually does the right thing at the semantic level and that it's not actually worth it trying to decompose into separate type classes.) |
Hi. Is there any chance that this PR can be accepted? |
Just to add to my previous comment: Even given the downsides of MonadMask, I think it would still be valuable to have this since it would mean less boilerplate if you're already using e.g. ReaderT IO ... which seems to be popular. If a better solution than MonadMask comes along later, it would still be possible to switch to that. |
Previously the fold-like operations were restricted to fold operations
in
IO
, greatly limiting their usefulness. Here we generalize them toany
MonadMask
, provided by the widely-usedexceptions
library.Resolves #9.