dephinera
02/01/2021, 3:31 PMeither1.fold(
ifLeft = { it.left() },
ifRight = { r1 ->
either2.fold(
ifLeft = { it.left() },
ifRight = { r2 -> mapper(r1, r2).right() },
)
}
)
The left type of both eithers is the same. I want to call mapper() if both of eithers are Right
. If one of them is Left
, mapper won't be called. The result type is Either<SameLeftType, ReturnedTypeFromMapper>
.than_
02/01/2021, 3:39 PMEither.mapN(e1, e2){ a, b -> mapper(a,b) }
dephinera
02/01/2021, 3:48 PMthan_
02/01/2021, 3:51 PMmapN(e1, e2){ a, b -> mapper(a,b) }
in 0.11.0dephinera
02/01/2021, 3:52 PMthan_
02/01/2021, 3:53 PMimport arrow.core.extensions.either.apply.mapN
I believe it can be found heredephinera
02/01/2021, 3:55 PMthan_
02/01/2021, 3:57 PMdephinera
02/01/2021, 3:58 PMthan_
02/01/2021, 3:59 PMdephinera
02/01/2021, 3:59 PM