Package-level declarations

Types

Link copied to clipboard
expect class AtomicRef<V>(initialValue: V)
actual class AtomicRef<V>(initialValue: V)
actual typealias AtomicRef = AtomicReference<V>
actual class AtomicRef<V>(initialValue: V)
Link copied to clipboard
interface EagerEffect<out R, out A>

RestrictsSuspension version of Effect. This version runs eagerly, and can be used in non-suspending code. An effect computation interoperates with an EagerEffect via bind.

Link copied to clipboard
interface EagerEffectScope<in R>

Context of the EagerEffect DSL.

Link copied to clipboard
interface Effect<out R, out A>

Effect represents a function of suspend () -> A, that short-circuit with a value of R (and Throwable), or completes with a value of A.

Link copied to clipboard
interface EffectScope<in R>

Context of the Effect DSL.

Link copied to clipboard
object either
Link copied to clipboard
object ior
Link copied to clipboard
Link copied to clipboard
class IorEffectScope<E>(semigroup: Semigroup<E>, effect: EffectScope<E>) : EffectScope<E> , Semigroup<E>
Link copied to clipboard
object nullable
Link copied to clipboard
Link copied to clipboard
object option
Link copied to clipboard
Link copied to clipboard
object result
Link copied to clipboard
Link copied to clipboard

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 Effect.

Functions

Link copied to clipboard
fun <R, A> eagerEffect(f: suspend EagerEffectScope<R>.() -> A): EagerEffect<R, A>

DSL for constructing EagerEffect<R, A> values

Link copied to clipboard
fun <R, A> effect(f: suspend EffectScope<R>.() -> A): Effect<R, A>

DSL for constructing Effect values

Link copied to clipboard
suspend fun <B> NullableEagerEffectScope.ensureNotNull(value: B?): B
suspend fun <B> NullableEffectScope.ensureNotNull(value: B?): B
suspend fun <B> OptionEagerEffectScope.ensureNotNull(value: B?): B
suspend fun <B> OptionEffectScope.ensureNotNull(value: B?): B

suspend fun <R, B : Any> EagerEffectScope<R>.ensureNotNull(value: B?, shift: () -> R): B
suspend fun <R, B : Any> EffectScope<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.

Link copied to clipboard
inline fun <V> AtomicRef<V>.getAndUpdate(function: (V) -> V): V

Updates variable atomically using the specified function of its value and returns its old value.

Link copied to clipboard
inline fun <V> AtomicRef<V>.loop(action: (V) -> Unit): Nothing

Infinite loop that reads this atomic variable and performs the specified action on its value.

Link copied to clipboard
fun <A> EagerEffect<A, A>.merge(): A
suspend fun <A> Effect<A, A>.merge(): A
Link copied to clipboard
suspend fun <A> Effect<None, A>.toOption(): Option<A>
Link copied to clipboard
Link copied to clipboard
inline fun <V> AtomicRef<V>.update(function: (V) -> V)
Link copied to clipboard
inline fun <V> AtomicRef<V>.updateAndGet(function: (V) -> V): V

Updates variable atomically using the specified function of its value and returns its new value.