【发布时间】:2022-10-02 09:00:22
【问题描述】:
标签: haskell monad-transformers applicative
标签: haskell monad-transformers applicative
docs page you linked for EitherT 清楚地表明 EitherT 是一个类型别名:
type EitherT =ExceptT为ExceptT 键入别名
这意味着它不能拥有自己的实例;它拥有的任何实例都将为它是别名的类型定义为了;在这种情况下
ExceptT。方便的是,它还链接到
ExceptT的文档。不方便的是,它将ExceptT的这两次出现链接到不同的URL!其中一个似乎是断开的链接(指向存在于mtl中的模块,就好像它存在于transformers-either包中一样),但另一个有效,并显示:(Functor m, Monad m) => Applicative (ExceptT e m)
【讨论】:
EitherT 定义为 type EitherT = ExceptT。与需要自己的实例的 newtype 包装器不同,type 同义词共享实例。 ExceptT 的实例在 Control.Monad.Trans.Except in the transformers package 中定义。
【讨论】: