IorRaise

class IorRaise<E> : Raise<E> , Semigroup<E>

Functions

Link copied to clipboard
open suspend fun <E, A> attempt(f: suspend EffectScope<E>.() -> A): Effect<E, A>
Link copied to clipboard
fun <B> Ior<E, B>.bind(): B
open fun <A> Validated<E, A>.bind(): A
open suspend fun <B> EagerEffect<E, B>.bind(): B
open suspend fun <B> Effect<E, B>.bind(): B
open fun <A> EagerEffect<E, A>.bind(): A
open suspend fun <A> Effect<E, A>.bind(): A

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> Option<A>.bind(transform: Raise<E>.(None) -> A): A

Extract the Some value out of Option, because Option works with None as its error type you need to transform to R.

open fun <A> Result<A>.bind(transform: (Throwable) -> E): A

Extract the Result.success value out of Result, because Result works with Throwable as its error type you need to transform to R.

Link copied to clipboard
open infix suspend fun <E, A> Effect<E, A>.catch(recover: suspend Raise<E>.(E) -> A): A
open fun <A> EagerEffect<E, A>.catch(catch: Raise<E>.(Throwable) -> A): A
open suspend fun <A> Effect<E, A>.catch(catch: suspend Raise<E>.(Throwable) -> A): A
Link copied to clipboard
open override fun E.combine(b: E): E

Combine two A values.

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
open override fun E.maybeCombine(b: E?): E
Link copied to clipboard
open operator override fun E.plus(b: E): E
Link copied to clipboard
open override fun raise(r: E): Nothing

Raise a logical failure of type R

Link copied to clipboard
open infix fun <E, A> EagerEffect<E, A>.recover(resolve: Raise<E>.(E) -> A): A
open infix suspend fun <E, A> Effect<E, A>.recover(resolve: suspend Raise<E>.(E) -> A): A

open suspend fun <E, A> Effect<E, A>.recover(action: suspend Raise<E>.() -> A, recover: suspend Raise<E>.(E) -> A, catch: suspend Raise<E>.(Throwable) -> A): A

Execute the Effect resulting in A, and recover from any logical error of type E, and Throwable, by providing a fallback value of type A, or raising a new error of type R.

Link copied to clipboard
open fun <B> shift(r: E): B

Extensions

Link copied to clipboard
inline fun <R, A> Raise<R>.catch(action: Raise<R>.() -> A, catch: Raise<R>.(Throwable) -> A): A
@JvmName(name = "catchReified")
inline fun <T : Throwable, R, A> Raise<R>.catch(action: Raise<R>.() -> A, catch: Raise<R>.(T) -> A): A
Link copied to clipboard
inline fun <R> Raise<R>.ensure(condition: Boolean, raise: () -> R)
Link copied to clipboard
inline fun <R, B : Any> Raise<R>.ensureNotNull(value: B?, raise: () -> R): B
Link copied to clipboard
inline fun <R, A> Raise<NonEmptyList<R>>.mapErrorNel(crossinline block: Raise<R>.() -> A): A

Re-raise any errors in block in a NonEmptyList.

Link copied to clipboard
inline fun <R, A, B> Raise<R>.mapOrAccumulate(semigroup: Semigroup<@UnsafeVariance R>, list: Iterable<A>, block: Raise<R>.(A) -> B): List<B>

Accumulate the errors obtained by executing the block over every element of list using the given semigroup.

inline fun <R, A, B> Raise<NonEmptyList<R>>.mapOrAccumulate(list: Iterable<A>, crossinline block: Raise<R>.(A) -> B): List<B>

Accumulate the errors obtained by executing the block over every element of list.

Link copied to clipboard
inline fun <R, E, A> Raise<R>.recover(action: Raise<E>.() -> A, recover: Raise<R>.(E) -> A): A

Execute the Raise context function resulting in A or any logical error of type E, and recover by providing a fallback value of type A or raising a new error of type R.

inline fun <R, E, A> Raise<R>.recover(action: Raise<E>.() -> A, recover: Raise<R>.(E) -> A, catch: Raise<R>.(Throwable) -> A): A
Link copied to clipboard
inline fun <R, A, B, C> Raise<R>.zipOrAccumulate(semigroup: Semigroup<@UnsafeVariance R>, action1: Raise<R>.() -> A, action2: Raise<R>.() -> B, block: Raise<R>.(A, B) -> C): C

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

inline fun <R, A, B, C, D> Raise<R>.zipOrAccumulate(semigroup: Semigroup<@UnsafeVariance R>, action1: Raise<R>.() -> A, action2: Raise<R>.() -> B, action3: Raise<R>.() -> C, block: Raise<R>.(A, B, C) -> D): D

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

inline fun <R, A, B, C, D, E> Raise<R>.zipOrAccumulate(semigroup: Semigroup<@UnsafeVariance R>, action1: Raise<R>.() -> A, action2: Raise<R>.() -> B, action3: Raise<R>.() -> C, action4: Raise<R>.() -> D, block: Raise<R>.(A, B, C, D) -> E): E

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

inline fun <R, A, B, C, D, E, F> Raise<R>.zipOrAccumulate(semigroup: Semigroup<@UnsafeVariance R>, action1: Raise<R>.() -> A, action2: Raise<R>.() -> B, action3: Raise<R>.() -> C, action4: Raise<R>.() -> D, action5: Raise<R>.() -> E, block: Raise<R>.(A, B, C, D, E) -> F): F

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

inline fun <R, A, B, C, D, E, F, G> Raise<R>.zipOrAccumulate(semigroup: Semigroup<@UnsafeVariance R>, action1: Raise<R>.() -> A, action2: Raise<R>.() -> B, action3: Raise<R>.() -> C, action4: Raise<R>.() -> D, action5: Raise<R>.() -> E, action6: Raise<R>.() -> F, block: Raise<R>.(A, B, C, D, E, F) -> G): G

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

inline fun <R, A, B, C, D, E, F, G, H> Raise<R>.zipOrAccumulate(semigroup: Semigroup<@UnsafeVariance R>, action1: Raise<R>.() -> A, action2: Raise<R>.() -> B, action3: Raise<R>.() -> C, action4: Raise<R>.() -> D, action5: Raise<R>.() -> E, action6: Raise<R>.() -> F, action7: Raise<R>.() -> G, block: Raise<R>.(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 semigroup.

inline fun <R, A, B, C, D, E, F, G, H, I> Raise<R>.zipOrAccumulate(semigroup: Semigroup<@UnsafeVariance R>, action1: Raise<R>.() -> A, action2: Raise<R>.() -> B, action3: Raise<R>.() -> C, action4: Raise<R>.() -> D, action5: Raise<R>.() -> E, action6: Raise<R>.() -> F, action7: Raise<R>.() -> G, action8: Raise<R>.() -> H, block: Raise<R>.(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 semigroup.

inline fun <R, A, B, C, D, E, F, G, H, I, J> Raise<R>.zipOrAccumulate(semigroup: Semigroup<@UnsafeVariance R>, action1: Raise<R>.() -> A, action2: Raise<R>.() -> B, action3: Raise<R>.() -> C, action4: Raise<R>.() -> D, action5: Raise<R>.() -> E, action6: Raise<R>.() -> F, action7: Raise<R>.() -> G, action8: Raise<R>.() -> H, action9: Raise<R>.() -> I, block: Raise<R>.(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 semigroup.

inline fun <R, A, B, C> Raise<NonEmptyList<R>>.zipOrAccumulate(crossinline action1: Raise<R>.() -> A, crossinline action2: Raise<R>.() -> B, crossinline block: Raise<R>.(A, B) -> C): C

Accumulate the errors from running both action1 and action2.

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

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

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

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

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

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

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

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

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

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

inline fun <R, A, B, C, D, E, F, G, H, I> Raise<NonEmptyList<R>>.zipOrAccumulate(crossinline action1: Raise<R>.() -> A, crossinline action2: Raise<R>.() -> B, crossinline action3: Raise<R>.() -> C, crossinline action4: Raise<R>.() -> D, crossinline action5: Raise<R>.() -> E, crossinline action6: Raise<R>.() -> F, crossinline action7: Raise<R>.() -> G, crossinline action8: Raise<R>.() -> H, crossinline block: Raise<R>.(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 <R, A, B, C, D, E, F, G, H, I, J> Raise<NonEmptyList<R>>.zipOrAccumulate(crossinline action1: Raise<R>.() -> A, crossinline action2: Raise<R>.() -> B, crossinline action3: Raise<R>.() -> C, crossinline action4: Raise<R>.() -> D, crossinline action5: Raise<R>.() -> E, crossinline action6: Raise<R>.() -> F, crossinline action7: Raise<R>.() -> G, crossinline action8: Raise<R>.() -> H, crossinline action9: Raise<R>.() -> I, crossinline block: Raise<R>.(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.