arrow-core-data / arrow.core / Either / resolve

resolve

suspend inline fun <E, A, B> ~~resolve~~(f: suspend () -> Either<E, A>, success: suspend (a: A) -> Either<Throwable, B>, error: suspend (e: E) -> Either<Throwable, B>, throwable: suspend (throwable: Throwable) -> Either<Throwable, B>, unrecoverableState: suspend (throwable: Throwable) -> Either<Throwable, Unit>): B Deprecated: Use the inline version. Hidden for binary compat

@JvmStatic inline fun <E, A, B> resolve(f: () -> Either<E, A>, success: (a: A) -> Either<Throwable, B>, error: (e: E) -> Either<Throwable, B>, throwable: (throwable: Throwable) -> Either<Throwable, B>, unrecoverableState: (throwable: Throwable) -> Either<Throwable, Unit>): B

The resolve function can resolve any suspended function that yields an Either into one type of value.

Parameters

f - the function that needs to be resolved.

success - the function to apply if f yields a success of type A.

error - the function to apply if f yields an error of type E.

throwable - the function to apply if f throws a Throwable. Throwing any Throwable in the throwable function will render the resolve function nondeterministic.

unrecoverableState - the function to apply if resolve is in an unrecoverable state.

Return the result of applying the resolve function.

Do you like Arrow?

Arrow Org
<