OutcomeOfRaise

class OutcomeOfRaise(raise: Raise<Any?>) : Raise<Throwable> (source)

Emulation of context receivers, when they're released this can be replaced by context receiver based code in Arrow itself.

We guarantee that the wrapped Any? will only result in Throwable or Absent. Exposing this as Raise<Throwable> gives natural interoperability with Raise<Throwable> DSLs (Either).

Constructors

Link copied to clipboard
constructor(raise: Raise<Any?>)

Functions

Link copied to clipboard
open suspend fun <OtherError, A> attempt(f: suspend EffectScope<OtherError>.() -> A): Effect<OtherError, A>
Link copied to clipboard
fun <A> OutcomeOf<A>.bind(): A
fun <A> Option<A>.bind(): A
open fun <A> Either<Throwable, A>.bind(): A
open fun <A> Validated<Throwable, A>.bind(): A
open suspend fun <A> EagerEffect<Throwable, A>.bind(): A
open suspend fun <A> Effect<Throwable, A>.bind(): A
open fun <A> EagerEffect<Throwable, A>.bind(): A
open suspend fun <A> suspend Raise<Throwable>.() -> A.bind(): A

fun <A> Result<Option<A>>.bind(): A

Converts Result<Option<A>> to OutcomeOf and binds over the value

Link copied to clipboard
open fun <A> NonEmptyList<Either<Throwable, A>>.bindAll(): NonEmptyList<A>
open fun <A> NonEmptySet<Either<Throwable, A>>.bindAll(): NonEmptySet<A>
open fun <A> Iterable<Either<Throwable, A>>.bindAll(): List<A>
open fun <K, A> Map<K, Either<Throwable, A>>.bindAll(): Map<K, A>
Link copied to clipboard
fun <A> A?.bindNull(): A

Ensures a nullable value is not null. Will raise Absent on null.

Link copied to clipboard
fun <A> ErrorOr<Option<A>>.bindOption(): A

Converts an ErrorOr> to an OutcomeOf and binds over the value

Link copied to clipboard
fun <A> Result<A>.bindResult(): A

Converts Result<A> to OutcomeOf and binds over the value

Link copied to clipboard
open infix suspend fun <OtherError, A> Effect<OtherError, A>.catch(recover: suspend Raise<Throwable>.(otherError: OtherError) -> A): A
Link copied to clipboard
fun ensure(condition: Boolean)

Ensures the condition is met and raises an Absent otherwise.

Link copied to clipboard
fun <A : Any> ensureNotNull(value: A?): A
Link copied to clipboard
open operator fun <A> EagerEffect<Throwable, A>.invoke(): A
open suspend operator fun <A> suspend Raise<Throwable>.() -> A.invoke(): A
Link copied to clipboard
open override fun raise(r: Throwable): Nothing
Link copied to clipboard
open fun <A> shift(r: Throwable): A