As I want to combine Kleisli
that works on long methods Future
that can fail Either
, I need to stack the effect. Here is the resulting code to stack the effect in the Kleisli. Is there an existing combinator in scalaz ?
type FutureEitherT[A] = EitherT[Future, String, A]
def toKleisliEitherTFromDisjunction[A](f: Kleisli[Future, Context,String \/ A]) =
Kleisli[FutureEitherT, Context, A] { ctx => EitherT(f(ctx)) }
I've tried without success f.liftMK[FutureEitherT]
, but unfortunately, the third types in the Kleisli
type constructor is still an Either
.