Haskell 的 EitherT 怎么了?

What happened to Haskell's EitherT?

在阅读标题为 Breaking from a Loop by Gabriel Gonzalez it became apparent that the spotlighted EitherT has somehow left the ecosystem. The EitherT package states that it is deprecated in favour of either 的旧 (2012) 博客 post 时 - 实际上根本不关心 monad 转换器。

我注意到有人试图清理似乎在 10 年前就存在的错误处理混乱。我的猜测是不再需要 EitherT

我认为博客 post 中介绍的 loop-breaking 方法非常巧妙。所以我想知道:今天 EitherT 的替代品是什么?我认为,出于这个目的,对 ErrorT 的批评仍然有效,并且 ContT 对于这个小问题确实是相当笨重的机器。

作为参考,这里是博客中讨论的成语post:

import Control.Monad.Transfomers.EitherT

exit = left 

main = runEitherT $ forever $ do
    str <- lift getLine
    when (str == "exit") $ exit ()

(顺便说一下,同一作者的 Control.Break 规避了整个 EitherTErrorTContTExceptT 的混乱局面。 )

今天 EitherT 的替代品是 ExceptT:

import Control.Monad.Except

-- use `throwError` in place of `left`
exit = throwError

-- use `runExceptT` in place of `runEitherT`
main = runExceptT $ forever $ do
    str <- lift getLine
    when (str == "exit") $ exit ()