ResultRaise

Implementation of Raise used by result. You should never use this directly.

Constructors

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

Functions

Link copied to clipboard
open override fun <A> Either<Throwable, A>.bind(): A

Extract the Either.Right value of an Either. Any encountered Either.Left will be raised as a logical failure in this Raise context. You can wrap the bind call in recover if you want to attempt to recover from any logical failure.

open suspend override fun <A> EagerEffect<Throwable, A>.bind(): A
open suspend override fun <A> Effect<Throwable, A>.bind(): A
fun <A> Result<A>.bind(): A

open override fun <A> EagerEffect<Throwable, A>.bind(): A

Invoke an EagerEffect inside this Raise context. Any logical failure is raised in this Raise context, and thus short-circuits the computation.

open suspend override fun <A> Effect<Throwable, A>.bind(): A

Invoke an Effect inside this Raise context. Any logical failure raised are raised in this Raise context, and thus short-circuits the computation.

Link copied to clipboard
open override fun <A> NonEmptyList<Either<Throwable, A>>.bindAll(): NonEmptyList<A>

Extracts all the values in the NonEmptyList, raising every Either.Left as a logical failure. In other words, executed bind over every value in this NonEmptyList.

open override fun <A> NonEmptySet<Either<Throwable, A>>.bindAll(): NonEmptySet<A>

Extracts all the values in the NonEmptySet, raising every Either.Left as a logical failure. In other words, executed bind over every value in this NonEmptySet.

open override fun <A> Iterable<Either<Throwable, A>>.bindAll(): List<A>

Extracts all the values in the Iterable, raising every Either.Left as a logical failure. In other words, executed bind over every value in this Iterable.

open override fun <K, A> Map<K, Either<Throwable, A>>.bindAll(): Map<K, A>

Extracts all the values in the Map, raising every Either.Left as a logical failure. In other words, executed bind over every value in this Map.

@JvmName(name = "bindAllResult")
fun <A> NonEmptyList<Result<A>>.bindAll(): NonEmptyList<A>
@JvmName(name = "bindAllResult")
fun <A> NonEmptySet<Result<A>>.bindAll(): NonEmptySet<A>
@JvmName(name = "bindAllResult")
fun <A> Iterable<Result<A>>.bindAll(): List<A>
@JvmName(name = "bindAllResult")
fun <K, V> Map<K, Result<V>>.bindAll(): Map<K, V>
Link copied to clipboard
inline fun <Error> Raise<Error>.ensure(condition: Boolean, raise: () -> Error)

Ensures that the condition is met; otherwise, Raise.raises a logical failure of type Error.

Link copied to clipboard
inline fun <Error, B : Any> Raise<Error>.ensureNotNull(value: B?, raise: () -> Error): B

Ensures that the value is not null; otherwise, Raise.raises a logical failure of type Error.

Link copied to clipboard
inline fun <Error, A> Raise<Error>.forEachAccumulating(iterable: Iterable<A>, combine: (Error, Error) -> Error, block: RaiseAccumulate<Error>.(A) -> Unit)
inline fun <Error, A> Raise<Error>.forEachAccumulating(iterator: Iterator<A>, combine: (Error, Error) -> Error, block: RaiseAccumulate<Error>.(A) -> Unit)
inline fun <Error, A> Raise<Error>.forEachAccumulating(sequence: Sequence<A>, combine: (Error, Error) -> Error, block: RaiseAccumulate<Error>.(A) -> Unit)
Link copied to clipboard
open operator override fun <A> EagerEffect<Throwable, A>.invoke(): A

Invoke an EagerEffect inside this Raise context. Any logical failure is raised in this Raise context, and thus short-circuits the computation.

open suspend operator override fun <A> Effect<Throwable, A>.invoke(): A

Invoke an Effect inside this Raise context. Any logical failure raised are raised in this Raise context, and thus short-circuits the computation.

Link copied to clipboard
inline fun <Error, A, B> Raise<NonEmptyList<Error>>.mapOrAccumulate(nonEmptyList: NonEmptyList<A>, transform: RaiseAccumulate<Error>.(A) -> B): NonEmptyList<B>

Accumulate the errors obtained by executing the transform over every element of NonEmptyList.

inline fun <Error, A, B> Raise<NonEmptyList<Error>>.mapOrAccumulate(nonEmptySet: NonEmptySet<A>, transform: RaiseAccumulate<Error>.(A) -> B): NonEmptySet<B>

Accumulate the errors obtained by executing the transform over every element of NonEmptySet.

inline fun <Error, A, B> Raise<NonEmptyList<Error>>.mapOrAccumulate(iterable: Iterable<A>, transform: RaiseAccumulate<Error>.(A) -> B): List<B>

Accumulate the errors obtained by executing the transform over every element of iterable.

inline fun <K, Error, A, B> Raise<NonEmptyList<Error>>.mapOrAccumulate(map: Map<K, A>, transform: RaiseAccumulate<Error>.(Map.Entry<K, A>) -> B): Map<K, B>
inline fun <K, Error, A, B> Raise<Error>.mapOrAccumulate(map: Map<K, A>, combine: (Error, Error) -> Error, transform: RaiseAccumulate<Error>.(Map.Entry<K, A>) -> B): Map<K, B>

inline fun <Error, A, B> Raise<NonEmptyList<Error>>.mapOrAccumulate(sequence: Sequence<A>, transform: RaiseAccumulate<Error>.(A) -> B): List<B>

Accumulate the errors obtained by executing the transform over every element of sequence.

inline fun <Error, A, B> Raise<Error>.mapOrAccumulate(iterable: Iterable<A>, combine: (Error, Error) -> Error, transform: RaiseAccumulate<Error>.(A) -> B): List<B>

Transform every element of iterable using the given transform, or accumulate all the occurred errors using combine.

inline fun <Error, A, B> Raise<Error>.mapOrAccumulate(sequence: Sequence<A>, combine: (Error, Error) -> Error, transform: RaiseAccumulate<Error>.(A) -> B): List<B>

Transform every element of sequence using the given transform, or accumulate all the occurred errors using combine.

Link copied to clipboard
open override fun raise(r: Throwable): Nothing

Raises a logical failure of type Error. This function behaves like a return statement, immediately short-circuiting and terminating the computation.

Link copied to clipboard
inline fun <A> recover(block: ResultRaise.() -> A, recover: (Throwable) -> A): A
Link copied to clipboard
inline fun <Error, A> Raise<Error>.traced(block: Raise<Error>.() -> A, trace: (trace: Trace, error: Error) -> Unit): A

Inspect a Trace value of Error.

Link copied to clipboard
inline fun <Error, OtherError, A> Raise<Error>.withError(transform: (OtherError) -> Error, block: Raise<OtherError>.() -> A): A

Execute the Raise context function resulting in A or any logical error of type OtherError, and transform any raised OtherError into Error, which is raised to the outer Raise.

Link copied to clipboard
inline fun <Error, A, B, C> Raise<NonEmptyList<Error>>.zipOrAccumulate(action1: RaiseAccumulate<Error>.() -> A, action2: RaiseAccumulate<Error>.() -> B, block: (A, B) -> C): C

Accumulate the errors from running both action1 and action2.

inline fun <Error, A, B, C> Raise<Error>.zipOrAccumulate(combine: (Error, Error) -> Error, action1: RaiseAccumulate<Error>.() -> A, action2: RaiseAccumulate<Error>.() -> B, block: (A, B) -> C): C

Accumulate the errors from running both action1 and action2 using the given combine function.

inline fun <Error, A, B, C, D> Raise<NonEmptyList<Error>>.zipOrAccumulate(action1: RaiseAccumulate<Error>.() -> A, action2: RaiseAccumulate<Error>.() -> B, action3: RaiseAccumulate<Error>.() -> C, block: (A, B, C) -> D): D

Accumulate the errors from running action1, action2, and action3.

inline fun <Error, A, B, C, D> Raise<Error>.zipOrAccumulate(combine: (Error, Error) -> Error, action1: RaiseAccumulate<Error>.() -> A, action2: RaiseAccumulate<Error>.() -> B, action3: RaiseAccumulate<Error>.() -> C, block: (A, B, C) -> D): D

Accumulate the errors from running action1, action2, and action3 using the given combine.

inline fun <Error, A, B, C, D, E> Raise<NonEmptyList<Error>>.zipOrAccumulate(action1: RaiseAccumulate<Error>.() -> A, action2: RaiseAccumulate<Error>.() -> B, action3: RaiseAccumulate<Error>.() -> C, action4: RaiseAccumulate<Error>.() -> D, block: (A, B, C, D) -> E): E

Accumulate the errors from running action1, action2, action3, and action4.

inline fun <Error, A, B, C, D, E> Raise<Error>.zipOrAccumulate(combine: (Error, Error) -> Error, action1: RaiseAccumulate<Error>.() -> A, action2: RaiseAccumulate<Error>.() -> B, action3: RaiseAccumulate<Error>.() -> C, action4: RaiseAccumulate<Error>.() -> D, block: (A, B, C, D) -> E): E

Accumulate the errors from running action1, action2, action3, and action4 using the given combine.

inline fun <Error, A, B, C, D, E, F> Raise<NonEmptyList<Error>>.zipOrAccumulate(action1: RaiseAccumulate<Error>.() -> A, action2: RaiseAccumulate<Error>.() -> B, action3: RaiseAccumulate<Error>.() -> C, action4: RaiseAccumulate<Error>.() -> D, action5: RaiseAccumulate<Error>.() -> E, block: (A, B, C, D, E) -> F): F

Accumulate the errors from running action1, action2, action3, action4, and action5.

inline fun <Error, A, B, C, D, E, F> Raise<Error>.zipOrAccumulate(combine: (Error, Error) -> Error, action1: RaiseAccumulate<Error>.() -> A, action2: RaiseAccumulate<Error>.() -> B, action3: RaiseAccumulate<Error>.() -> C, action4: RaiseAccumulate<Error>.() -> D, action5: RaiseAccumulate<Error>.() -> E, block: (A, B, C, D, E) -> F): F

Accumulate the errors from running action1, action2, action3, action4, and action5 using the given combine.

inline fun <Error, A, B, C, D, E, F, G> Raise<NonEmptyList<Error>>.zipOrAccumulate(action1: RaiseAccumulate<Error>.() -> A, action2: RaiseAccumulate<Error>.() -> B, action3: RaiseAccumulate<Error>.() -> C, action4: RaiseAccumulate<Error>.() -> D, action5: RaiseAccumulate<Error>.() -> E, action6: RaiseAccumulate<Error>.() -> F, block: (A, B, C, D, E, F) -> G): G

Accumulate the errors from running action1, action2, action3, action4, action5, and action6.

inline fun <Error, A, B, C, D, E, F, G> Raise<Error>.zipOrAccumulate(combine: (Error, Error) -> Error, action1: RaiseAccumulate<Error>.() -> A, action2: RaiseAccumulate<Error>.() -> B, action3: RaiseAccumulate<Error>.() -> C, action4: RaiseAccumulate<Error>.() -> D, action5: RaiseAccumulate<Error>.() -> E, action6: RaiseAccumulate<Error>.() -> F, block: (A, B, C, D, E, F) -> G): G

Accumulate the errors from running action1, action2, action3, action4, action5, and action6 using the given combine.

inline fun <Error, A, B, C, D, E, F, G, H> Raise<NonEmptyList<Error>>.zipOrAccumulate(action1: RaiseAccumulate<Error>.() -> A, action2: RaiseAccumulate<Error>.() -> B, action3: RaiseAccumulate<Error>.() -> C, action4: RaiseAccumulate<Error>.() -> D, action5: RaiseAccumulate<Error>.() -> E, action6: RaiseAccumulate<Error>.() -> F, action7: RaiseAccumulate<Error>.() -> G, block: (A, B, C, D, E, F, G) -> H): H

Accumulate the errors from running action1, action2, action3, action4, action5, action6, and action7.

inline fun <Error, A, B, C, D, E, F, G, H> Raise<Error>.zipOrAccumulate(combine: (Error, Error) -> Error, action1: RaiseAccumulate<Error>.() -> A, action2: RaiseAccumulate<Error>.() -> B, action3: RaiseAccumulate<Error>.() -> C, action4: RaiseAccumulate<Error>.() -> D, action5: RaiseAccumulate<Error>.() -> E, action6: RaiseAccumulate<Error>.() -> F, action7: RaiseAccumulate<Error>.() -> G, block: (A, B, C, D, E, F, G) -> H): H

Accumulate the errors from running action1, action2, action3, action4, action5, action6, and action7 using the given combine.

inline fun <Error, A, B, C, D, E, F, G, H, I> Raise<NonEmptyList<Error>>.zipOrAccumulate(action1: RaiseAccumulate<Error>.() -> A, action2: RaiseAccumulate<Error>.() -> B, action3: RaiseAccumulate<Error>.() -> C, action4: RaiseAccumulate<Error>.() -> D, action5: RaiseAccumulate<Error>.() -> E, action6: RaiseAccumulate<Error>.() -> F, action7: RaiseAccumulate<Error>.() -> G, action8: RaiseAccumulate<Error>.() -> H, block: (A, B, C, D, E, F, G, H) -> I): I

Accumulate the errors from running action1, action2, action3, action4, action5, action6, action7, and action8.

inline fun <Error, A, B, C, D, E, F, G, H, I> Raise<Error>.zipOrAccumulate(combine: (Error, Error) -> Error, action1: RaiseAccumulate<Error>.() -> A, action2: RaiseAccumulate<Error>.() -> B, action3: RaiseAccumulate<Error>.() -> C, action4: RaiseAccumulate<Error>.() -> D, action5: RaiseAccumulate<Error>.() -> E, action6: RaiseAccumulate<Error>.() -> F, action7: RaiseAccumulate<Error>.() -> G, action8: RaiseAccumulate<Error>.() -> H, block: (A, B, C, D, E, F, G, H) -> I): I

Accumulate the errors from running action1, action2, action3, action4, action5, action6, action7, and action8 using the given combine.

inline fun <Error, A, B, C, D, E, F, G, H, I, J> Raise<NonEmptyList<Error>>.zipOrAccumulate(action1: RaiseAccumulate<Error>.() -> A, action2: RaiseAccumulate<Error>.() -> B, action3: RaiseAccumulate<Error>.() -> C, action4: RaiseAccumulate<Error>.() -> D, action5: RaiseAccumulate<Error>.() -> E, action6: RaiseAccumulate<Error>.() -> F, action7: RaiseAccumulate<Error>.() -> G, action8: RaiseAccumulate<Error>.() -> H, action9: RaiseAccumulate<Error>.() -> I, block: (A, B, C, D, E, F, G, H, I) -> J): J

Accumulate the errors from running action1, action2, action3, action4, action5, action6, action7, action8, and action9.

inline fun <Error, A, B, C, D, E, F, G, H, I, J> Raise<Error>.zipOrAccumulate(combine: (Error, Error) -> Error, action1: RaiseAccumulate<Error>.() -> A, action2: RaiseAccumulate<Error>.() -> B, action3: RaiseAccumulate<Error>.() -> C, action4: RaiseAccumulate<Error>.() -> D, action5: RaiseAccumulate<Error>.() -> E, action6: RaiseAccumulate<Error>.() -> F, action7: RaiseAccumulate<Error>.() -> G, action8: RaiseAccumulate<Error>.() -> H, action9: RaiseAccumulate<Error>.() -> I, block: (A, B, C, D, E, F, G, H, I) -> J): J

Accumulate the errors from running action1, action2, action3, action4, action5, action6, action7, action8, and action9 using the given combine.