为什么 ExceptT 有一个 MonadMask 实例?
Why is there a MonadMask instance for ExceptT?
在之前的问题中,我问过
并得到了一些令人信服的答案,包括来自库作者的答案,为什么不存在一个合法的实例。
截至 2018 年 2 月,exceptions library does now have an instance of MonadMask for ExceptT。
所以现在我问的是完全相反的问题:为什么我上一个问题的答案不正确?
exceptions
库的文档在其文档中有答案:
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...
(注意:generalBracket
的类型在 0.10 中已更改,请勿使用 0.9)。
在之前的问题中,我问过
并得到了一些令人信服的答案,包括来自库作者的答案,为什么不存在一个合法的实例。
截至 2018 年 2 月,exceptions library does now have an instance of MonadMask for ExceptT。
所以现在我问的是完全相反的问题:为什么我上一个问题的答案不正确?
exceptions
库的文档在其文档中有答案:
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...
(注意:generalBracket
的类型在 0.10 中已更改,请勿使用 0.9)。