在上一个问题中,我问
Why is there no MonadMask instance for ExceptT?
并得到了许多令人信服的答案,包括图书馆作者,为什么不存在合法的例子。
截至 2018 年 2 月,exceptions库现在确实有 MonadMask 的实例对于 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)。
关于haskell - 为什么有一个用于 exceptT 的 MonadMask 实例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50318471/