Why is there a MonadMask instance for ExceptT?

六眼飞鱼酱① 提交于 2019-12-10 13:19:55

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/50318471/why-is-there-a-monadmask-instance-for-exceptt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!