SingletonRaise

class SingletonRaise<in E>(raise: Raise<Unit>) : Raise<E>

Constructors

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

Functions

Link copied to clipboard
inline fun <Error, A> Raise<NonEmptyList<Error>>.accumulate(block: RaiseAccumulate<Error>.() -> A): A
Link copied to clipboard
open fun <A> Either<E, 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 fun <A> EagerEffect<E, 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 fun <A> Effect<E, 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.

fun <A> A?.bind(): A
fun <A> Option<A>.bind(): A
Link copied to clipboard

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.

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 fun <A> Iterable<Either<E, A>>.bindAll(): List<A>
@JvmName(name = "bindAllNullable")
fun <A> NonEmptyList<A?>.bindAll(): NonEmptyList<A>
@JvmName(name = "bindAllOption")
fun <A> NonEmptyList<Option<A>>.bindAll(): NonEmptyList<A>
@JvmName(name = "bindAllNullable")
fun <A> NonEmptySet<A?>.bindAll(): NonEmptySet<A>
@JvmName(name = "bindAllOption")
fun <A> NonEmptySet<Option<A>>.bindAll(): NonEmptySet<A>
@JvmName(name = "bindAllNullable")
fun <A> Iterable<A?>.bindAll(): List<A>
@JvmName(name = "bindAllOption")
fun <A> Iterable<Option<A>>.bindAll(): List<A>
@JvmName(name = "bindAllNullable")
fun <K, V> Map<K, V?>.bindAll(): Map<K, V>
@JvmName(name = "bindAllOption")
fun <K, V> Map<K, Option<V>>.bindAll(): Map<K, V>

open fun <K, A> Map<K, Either<E, 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.

Link copied to clipboard
fun ensure(condition: Boolean)
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
fun <A> ensureNotNull(value: A?): A
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
inline fun <A> ignoreErrors(block: SingletonRaise<Any?>.() -> A): A

Introduces a scope where you can bind errors of any type, but no information is saved in the raise case.

Link copied to clipboard
open operator fun <A> EagerEffect<E, 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 fun <A> Effect<E, 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
inline fun <K, Error, A, B> Raise<NonEmptyList<Error>>.mapValuesOrAccumulate(map: Map<K, A>, transform: RaiseAccumulate<Error>.(Map.Entry<K, A>) -> B): Map<K, B>
inline fun <K, Error, A, B> Raise<Error>.mapValuesOrAccumulate(map: Map<K, A>, combine: (Error, Error) -> Error, transform: RaiseAccumulate<Error>.(Map.Entry<K, A>) -> B): Map<K, B>
Link copied to clipboard
fun raise(): Nothing

open override fun raise(r: E): 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: SingletonRaise<E>.() -> A, raise: () -> 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.