In a previous question, I asked
Why is there no MonadMask instance for ExceptT?
and got a number of compelling answers, including from the library author, why there cannot exist a lawful instance.
As of February 2018, the exceptions library does now have an instance of MonadMask for ExceptT.
So now I'm asking the exact opposite question: Why are the answers to my previous question incorrect?
The documentation of the exceptions
library has the answer in its docs:
This method was added in version 0.9.0 of this library. Previously, implementation of functions like
bracket
andfinally
in this module were based on themask
anduninterruptibleMask
functions only, disallowing some classes of transformers from havingMonadMask
instances (notably multi-exit-point transformers likeExceptT
). If you are a library author, you'll now need to provide an implementation for this method...
(Note: the type of generalBracket
were changed in 0.10, don't use 0.9).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With