为什么ExceptT有MonadMask实例? [英] Why is there a MonadMask instance for ExceptT?
问题描述
在前面的问题中,我问过
并获得了许多令人信服的答案,包括来自图书馆作者,为什么不能存在合法实例。
截至2018年2月,例外库的确现在有一个 MonadMask for ExceptT 。
所以现在我问的是完全相反的问题:为什么我以前的问题的答案不正确?
例外
库在文档中有答案:
该方法在该库的版本0.9.0中添加。以前,在这个模块中实现像
括号
和finally
这样的函数是基于掩码
和uninterruptibleMask
函数,但不允许某些类别的变换器具有MonadMask
像ExceptT
这样的退出点转换器)。如果您是图书馆作者,您现在需要提供此方法的实施...
(注意:类型 generalBracket
在0.10中更改,请勿使用0.9)。
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).
这篇关于为什么ExceptT有MonadMask实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!