redeem With
inline fun <A, B, C, D> Either<A, B>.redeemWith(fa: (A) -> Either<C, D>, fb: (B) -> Either<C, D>): Either<C, D>
Content copied to clipboard
inline fun <A, B> Option<A>.redeemWith(fe: (Unit) -> Option<B>, fb: (A) -> Option<B>): Option<B>
Content copied to clipboard
inline fun <A, B> Result<A>.redeemWith(handleErrorWith: (throwable: Throwable) -> Result<B>, transform: (A) -> Result<B>): Result<B>
Content copied to clipboard
Compose both:
a transform operation on the success value A into B whilst flattening Result.
a recovering transform operation on the failure value Throwable whilst flattening Result.
Combining the powers of flatMap and handleErrorWith.