Tristan Blakers
09/08/2020, 1:10 AMsuspend fun <A, B, C> EitherOf<A, B>.flatMapSuspend(f: suspend (B) -> Either<A, C>): Either<A, C> =
fix().let {
when (it) {
is Either.Right -> f(it.b)
is Either.Left -> it
}
}
Youssef Shoaib [MOD]
09/08/2020, 2:32 PMthan_
09/08/2020, 3:35 PMeither{
someEither.bind().let{ someSuspendingStuff(it) }.bind()
}
this works 🙂Tristan Blakers
09/11/2020, 9:11 PM