haskell - 为什么有一个用于 exceptT 的 MonadMask 实例?

标签 haskell exception-handling monad-transformers

在上一个问题中,我问

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 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)。

关于haskell - 为什么有一个用于 exceptT 的 MonadMask 实例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50318471/

相关文章:

haskell - 使用列表理解查找列表中的单个元素

c - 带有两个反斜杠的行如何欺骗 C 预处理器?

error-handling - 所有异常的 Camel 死信 channel

Python:通过具有多个 Excepts 的 Try/Except block 传播异常

haskell - Map.lookup 的 Maybe 结果不是使用我的 Monad Transformer 堆栈进行类型检查

multithreading - 停止线程交错输出

haskell - 从 haskell 模块中提取导入模块的列表

java - 套接字关闭的嵌套 IOException 捕获

haskell - 为什么 ContT 不处理内部单子(monad)?

Haskell Monad Transformer 堆栈和类型签名