How to lift \/[Error, Int]
into EitherT[Future, Error, Int]
using point/liftM
syntax such that lifting is on the right-hand side?
I have the following scenario
for {
r1 <- f1: EitherT[Future, Error, Int]
r2 <- v: \/[Error, Int]
r3 <- f2: EitherT[Future, Error, Int]
} yield r3
I can make v
fit by applying EitherT.fromDisjunction[Future]
like so
for {
r1 <- f1
r2 <- EitherT.fromDisjunction[Future](v)
r3 <- f2
} yield r3
or simply
for {
r1 <- f1
r2 <- EitherT(Future(v))
r3 <- f2
} yield r3
however I am trying to move the lifting magic to the right-hand-side of v
like so
for {
r1 <- f1
r2 <- v.point[Future].liftM[EitherT] // something approximately like this
r3 <- f2
} yield r3
I tried
type Result[F[_], A] = EitherT[F, Error, A]
v.point[Future].liftM[Result]
and
v.point[({ type L[x] = EitherT[Future, Error, x] })#L]
suggested here and here, however this types to
EitherT[Future, Error, Error \/ Int]
whilst I require
EitherT[Future, Error, Int]
Moving lifting to the right-hand-side is just for aesthetics, as EitherT.fromDisjunction[Future]
works fine.