ContSeq

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.

It's lazy, and thus allows for passing it around for composition.

It requires explicit running by using a terminal operator such as drain, forEach, toList or toSet.

Besides that ContSeq exposes APIs that you mind find on any other Monad.

Types

Link copied to clipboard
class Builder<A>(block: suspend ContSeqSyntax<A>.() -> Unit) : ContSeq<A>
Link copied to clipboard
object Companion

Smart-constructors

Link copied to clipboard
class Iterable<A>(aas: ContSeq.Iterable<A>) : ContSeq<A>
Link copied to clipboard
class VarArg<A>(aas: Array<out A>) : ContSeq<A>

Functions

Link copied to clipboard
fun drain()

Runs the sequence of computations, but ignore the output of every computation

Link copied to clipboard
fun <B> flatMap(f: (A) -> ContSeq<B>): ContSeq<B>
Link copied to clipboard
inline fun forEach(f: (A) -> Unit)

Alias for for-looping over all elements. Most efficient way to derive combinators.

Link copied to clipboard
abstract operator fun iterator(): Iterator<A>
Link copied to clipboard
fun <B> map(f: suspend ContSyntax.(A) -> B): ContSeq<B>

Maps every element in the sequence with f, and allows for aborting the mapped value using ContSyntax.abort or ContSyntax.ensure.

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

Side-effecting version of map

Link copied to clipboard
fun toList(): List<A>

Turns ContSeq into an in-memory representation as a List

Link copied to clipboard
fun toSet(): Set<A>

Turns ContSeq into an in-memory representation as a Set

Link copied to clipboard
fun void(): ContSeq<Unit>

Throws away the output of every emission

Link copied to clipboard
inline fun <B, C> zip(fb: ContSeq<B>, crossinline f: (A, B) -> C): ContSeq<C>

Inheritors

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard