Package arrow.meta.continuations

Types

ContSeq
Link copied to clipboard
sealed class ContSeq<out A>

ContSeq is multi-shot control-flow streaming type. It can emit 0..n elements, and it has ability to abort processing elements at any given time in the stream without aborting the whole stream.

ContSeqSyntax
Link copied to clipboard
interface ContSeqSyntax<in A> : ContSyntax

The scope for yielding values of a ContSeq, provides yield and yieldAll suspension functions.

ContSyntax
Link copied to clipboard
interface ContSyntax

ContSyntax exposes abort which allows for interruption of the computation, meaning that when abort is encountered the Cont will be interrupted and will not yield a value.

Functions

asContSeq
Link copied to clipboard
fun <A> Iterable<A>.asContSeq(): ContSeq<A>

Convert any Iterable into a ContSeq

cont
Link copied to clipboard
inline fun <A> cont(crossinline f: () -> A): ContSeq<A>

Smart constructor for single-shot ContSeq effect.

doOnlyWhen
Link copied to clipboard
inline fun doOnlyWhen(condition: Boolean, crossinline f: () -> ContSeq<Unit>): ContSeq<Unit>
inline fun <A> doOnlyWhen(condition: Boolean, value: A, crossinline f: () -> ContSeq<A>): ContSeq<A>

Execute a side effect only when some condition holds.

doOnlyWhenNotNull
Link copied to clipboard
inline fun <T, A> doOnlyWhenNotNull(thing: T?, value: A, crossinline f: (T) -> ContSeq<A>): ContSeq<A>

Execute a side effect only when some condition holds.

nested
Link copied to clipboard
fun <A> List<ContSeq<A>>.nested(): ContSeq<List<A>>
sequence
Link copied to clipboard
fun <A> List<ContSeq<A>>.sequence(): ContSeq<List<A>>

Execute a list of ContSeq and gather the values.