Package arrow

Types

Cont
Link copied to clipboard
interface Cont<R, A>

Cont represents a suspending computation that runs will either

ContEffect
Link copied to clipboard
interface ContEffect<R>

Context of the Cont DSL.

IorEffect
Link copied to clipboard
class IorEffect<E>(semigroup: Semigroup<E>, cont: ContEffect<E>) : ContEffect<E> , Semigroup<E>
OptionEffect
Link copied to clipboard
value class OptionEffect(cont: ContEffect<None>) : ContEffect<None>
RestrictedCont
Link copied to clipboard
interface RestrictedCont<R, A>
RestrictedContEffect
Link copied to clipboard
interface RestrictedContEffect<R>
ShiftCancellationException
Link copied to clipboard
sealed class ShiftCancellationException : CancellationException

AVOID USING THIS TYPE, it's meant for low-level cancellation code When in need in low-level code, you can use this type to differentiate between a foreign CancellationException and the one from Cont.

Functions

cont
Link copied to clipboard
fun <R, A> cont(f: suspend ContEffect<R>.() -> A): Cont<R, A>

DSL for constructing Cont values

either
Link copied to clipboard
suspend fun <E, A> either(f: suspend ContEffect<E>.() -> A): Either<E, A>
ensureNotNull
Link copied to clipboard
suspend fun <B : Any> ContEffect<None>.ensureNotNull(value: B?): B

suspend fun <R, B : Any> ContEffect<R>.ensureNotNull(value: B?, shift: () -> R): B

Ensure that value is not null. if it's non-null it will be smart-casted and returned if it's false it will shift with the provided value R. Monadic version of kotlin.requireNotNull.

ior
Link copied to clipboard
suspend fun <E, A> ior(semigroup: Semigroup<E>, f: suspend IorEffect<E>.() -> A): Ior<E, A>
option
Link copied to clipboard
suspend fun <A> option(f: OptionEffect.() -> A): Option<A>
restrictedCont
Link copied to clipboard
fun <R, A> restrictedCont(f: suspend RestrictedContEffect<R>.() -> A): RestrictedCont<R, A>

RestrictsSuspension version of Cont<R, A>. This version runs eagerly, can can be used in non-suspending code.

toOption
Link copied to clipboard
suspend fun <A> Cont<None, A>.toOption(): Option<A>