Is there no standard (Either a) monad instance?

守給你的承諾、 提交于 2019-11-30 11:19:22

This instance has been added in base 4.3.x.x, which comes with ghc 7. Meanwhile, you can use the Either instance directly, or, if you are using Either to represent something that may fail you should use ErrorT monad transformer.

As of base 4.6, the instance is in Data.Either itself.

There is not an instance for Either a, but there is for Either String in Control.Monad.Error. (Actually, it's for Error e => Either e, IIRC).

I believe there's something in Control.Monad.Error - don't have anything to check, though.

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