# Companion

common object Companion

## Functions

Name Summary
catch common
@JvmStatic
@JvmName(name = “tryCatch”)
inline fun <R> catch(f: () -> R): Either<Throwable, R>
@JvmStatic
@JvmName(name = “tryCatch”)
inline fun <L, R> catch(fe: (Throwable) -> L, f: () -> R): Either<L, R>
catchAndFlatten common
@JvmStatic
@JvmName(name = “tryCatchAndFlatten”)
inline fun <R> catchAndFlatten(f: () -> Either<Throwable, R>): Either<Throwable, R>
conditionally common
@JvmStatic
inline fun <L, R> conditionally(test: Boolean, ifFalse: () -> L, ifTrue: () -> R): Either<L, R>
Will create an Either from the result of evaluating the first parameter using the functions provided on second and third parameters. Second parameter represents function for creating an Left in case of a false result of evaluation and third parameter will be used to create a Right in case of a true result.
fromNullable common
@JvmStatic
fun <A> fromNullable(a: A?): Either<Unit, A>
lift common
@JvmStatic
fun <A, B, C> lift(f: (B) -> C): (Either<A, B>) -> Either<A, C>
Lifts a function `(B) -> C` to the Either structure returning a polymorphic function that can be applied over all Either values in the shape of Either
common
@JvmStatic
fun <A, B, C, D> lift(fa: (A) -> C, fb: (B) -> D): (Either<A, B>) -> Either<C, D>
resolve common
@JvmStatic
inline fun <E, A, B> resolve(f: () -> Either<E, A>, success: (A) -> Either<Throwable, B>, error: (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.

Do you like Arrow?

<