arrow-core-data / arrow.core / handleErrorWith

handleErrorWith

inline fun <A, B, C> EitherOf<A, B>.handleErrorWith(f: (A) -> EitherOf<C, B>): Either<C, B>

Applies the given function f if this is a Left, otherwise returns this if this is a Right. This is like flatMap for the exception.

inline fun <A> Option<A>.handleErrorWith(f: (Unit) -> Option<A>): Option<A> inline fun <E, A> ValidatedOf<E, A>.handleErrorWith(f: (E) -> ValidatedOf<E, A>): Validated<E, A>

Do you like Arrow?

Arrow Org
<