1
因为我想合并Kleisli
,对长方法Future
工作,可能会失败Either
,我需要叠加效果。下面是在Kleisli中叠加效果的结果代码。 scalaz中是否存在combinator?Kleisli [Future,Context, /] to Kleisli [EitherT,Context,...]
type FutureEitherT[A] = EitherT[Future, String, A]
def toKleisliEitherTFromDisjunction[A](f: Kleisli[Future, Context,String \/ A]) =
Kleisli[FutureEitherT, Context, A] { ctx => EitherT(f(ctx)) }
我已经尝试没有成功f.liftMK[FutureEitherT]
,但不幸的是,第三类型的Kleisli
类型构造仍是一个Either
。