Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is there a MonadMask instance for ExceptT?

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?

like image 863
Chris Martin Avatar asked May 13 '18 16:05

Chris Martin


1 Answers

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 and finally in this module were based on the mask and uninterruptibleMask functions only, disallowing some classes of transformers from having MonadMask instances (notably multi-exit-point transformers like ExceptT). 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).

like image 196
phadej Avatar answered Nov 13 '22 13:11

phadej