//arrow-core/arrow.core/redeemWith

redeemWith

common inline fun <A, B, C, D> Either<A, B>.redeemWith(fa: (A) -> Either<C, D>, fb: (B) -> Either<C, D>): Either<C, D>

inline fun <A, B> Option<A>.redeemWith(fe: (Unit) -> Option<B>, fb: (A) -> Option<B>): Option<B>

common inline fun <A, B> Result<A>.redeemWith(handleErrorWith: (throwable: Throwable) -> Result<B>, transform: (A) -> Result<B>): Result<B>

Compose both:

Combining the powers of flatMap and handleErrorWith.

Do you like Arrow?

Arrow Org
<