arrow-fx-coroutines / arrow.fx.coroutines.stream / Pull

Pull

sealed class ~~Pull~~<out O, out R> Deprecated: Pull is deprecated as part of Stream in favor of Flow

Types

Bind abstract class Bind<O, X, R> : Pull<O, R>
Result sealed class Result<out R> : Pull<Nothing, R>, ViewL<Nothing, R>

Functions

asHandler fun asHandler(e: Throwable): Pull<O, R>
attempt Returns a pull with the result wrapped in Right, or an error wrapped in Left if the pull has failed.fun attempt(): Pull<O, Either<Throwable, R>>
mapOutput abstract fun <P> mapOutput(f: (O) -> P): Pull<P, R>
toString open fun toString(): String
void Replaces the result of this pull with Unit.fun void(): Pull<O, Unit>

Companion Object Properties

done val done: Pull<Nothing, Unit>

Companion Object Functions

bracketCase fun <R> bracketCase(acquire: suspend () -> R, release: suspend (R, ExitCase) -> Unit): Pull<Nothing, R>
fun <O, A, B> bracketCase(acquire: Pull<O, A>, use: (A) -> Pull<O, B>, release: (A, ExitCase) -> Pull<O, Unit>): Pull<O, B>
defer fun <O, R> defer(fr: () -> Pull<O, R>): Pull<O, R>
done fun <O> done(): Pull<O, Unit>
effect fun <R> effect(effect: suspend () -> R): Pull<Nothing, R>
just fun <R> just(r: R): Pull<Nothing, R>
loop Repeatedly uses the output of the pull as input for the next step of the pull. Halts when a step terminates with null or Pull.raiseError.fun <O, R> loop(r: R, using: (R) -> Pull<O, R?>): Pull<O, R?>
output fun <O> output(chunk: Chunk<O>): Pull<O, Unit>
output1 fun <O> output1(value: O): Pull<O, Unit>
raiseError fun raiseError(e: Throwable): Pull<Nothing, Nothing>
scope_ Wraps supplied pull in new scope, that will be opened before this pull is evaluated and closed once this pull either finishes its evaluation or when it fails.fun <O> scope_(s: Pull<O, Unit>, interruptible: Boolean): Pull<O, Unit>

Extension Functions

append fun <O, R> Pull<O, R>.append(post: () -> Pull<O, R>): Pull<O, R>
cons fun <O, B> Pull<O, B>.cons(c: Chunk<O>): Pull<O, B>
fun <O, B> Pull<O, B>.cons(o: O): Pull<O, B>
drop Drops the first n elements read by this Pull and returnsfun <O> Pull<O, Unit>.drop(n: Long): Pull<O, Unit>
dropThrough Like dropWhile, but drops the first value which tests false.fun <O> Pull<O, Unit>.dropThrough(p: (O) -> Boolean): Pull<O, Unit>
dropWhile Drops elements of the this stream until the predicate p fails, and returns the new stream. If defined, the first element of the returned stream will fail p.fun <O> Pull<O, Unit>.dropWhile(p: (O) -> Boolean): Pull<O, Unit>
dropWhile_ fun <O> Pull<O, Unit>.dropWhile_(p: (O) -> Boolean, dropFailure: Boolean): Pull<O, Pull<O, Unit>>
echo1 Reads a single element from the input and emits it to the output.fun <O> Pull<O, Unit>.echo1(): Pull<O, Pull<O, Unit>?>
echoChunk Reads the next available chunk from the input and emits it to the output.fun <O> Pull<O, Unit>.echoChunk(): Pull<O, Pull<O, Unit>?>
fetchN Like unconsN, but leaves the buffered input unconsumed.fun <O> Pull<O, Unit>.fetchN(n: Int): Pull<O, Pull<O, Unit>?>
firstOrNull Awaits the next available element where the predicate returns true.fun <O> Pull<O, Unit>.firstOrNull(f: (O) -> Boolean): Pull<Nothing, PullUncons1<O>?>
flatMap fun <O, O2 : O, R, R2> Pull<O, R>.flatMap(f: (R) -> Pull<O2, R2>): Pull<O2, R2>
flatMapOutput fun <O, O2> Pull<O, Unit>.flatMapOutput(f: (O) -> Pull<O2, Unit>): Pull<O2, Unit>
flatten fun <O, R> Pull<O, Pull<O, R>>.flatten(): Pull<O, R>
fold Folds all inputs using an initial value z and supplied binary operator, and writes the final result to the output of the supplied Pull when the stream has no more values.fun <O, O2> Pull<O, Unit>.fold(initial: O2, f: (O2, O) -> O2): Pull<Nothing, O2>
fold1 Folds all inputs using the supplied binary operator, and writes the final result to the output of the supplied Pull when the stream has no more values.fun <O> Pull<O, Unit>.fold1(f: (O, O) -> O): Pull<Nothing, O?>
forall Writes a single true value if all input matches the predicate, false otherwise.fun <O> Pull<O, Unit>.forall(p: (O) -> Boolean): Pull<Nothing, Boolean>
handleErrorWith fun <O, R> Pull<O, R>.handleErrorWith(f: (Throwable) -> Pull<O, R>): Pull<O, R>
interruptScope Creates a scope that may be interrupted by calling scope#interrupt.fun <O> Pull<O, Unit>.interruptScope(): Pull<O, Unit>
map fun <O, R, R2> Pull<O, R>.map(f: (R) -> R2): Pull<O, R2>
peek Like uncons but does not consume the chunk (i.e., the chunk is pushed back).fun <O> Pull<O, Unit>.peek(): Pull<Nothing, PullUncons<O>?>
peek1 Like uncons1 but does not consume the element (i.e., the element is pushed back).fun <O> Pull<O, Unit>.peek1(): Pull<Nothing, PullUncons1<O>?>
repeat Repeatedly invokes using, running the resultant Pull each time, halting when a pull returns null instead of nextStream.fun <O, B> Pull<O, Unit>.repeat(using: (Pull<O, Unit>) -> Pull<B, Pull<O, Unit>?>): Pull<B, Unit>
scanChunks Like scan but f is applied to each chunk of the source stream. The resulting chunk is emitted and the result of the chunk is used in the next invocation of f. The final state value is returned as the result of the pull.fun <O, S, O2> Pull<O, Unit>.scanChunks(init: S, f: (S, Chunk<O>) -> Pair<S, Chunk<O2>>): Pull<O2, S>
scanChunksOpt More general version of scanChunks where the current state (i.e., S) can be inspected to determine if another chunk should be pulled or if the pull should terminate. Termination is signaled by returning None from f. Otherwise, a function which consumes the next chunk is returned wrapped in Some. The final state value is returned as the result of the pull.fun <O, S, O2> Pull<O, Unit>.scanChunksOpt(init: S, f: (S) -> ((Chunk<O>) -> Pair<S, Chunk<O2>>)?): Pull<O2, S>
scope fun <O> Pull<O, Unit>.scope(): Pull<O, Unit>
stepLeg Like uncons, but instead of performing normal uncons, this will run the stream up to the first chunk available. Useful when zipping multiple streams (legs) into one stream. Assures that scopes are correctly held for each stream leg independently of scopes from other legs.fun <O> Pull<O, Unit>.stepLeg(): Pull<Nothing, StepLeg<O>?>
stream Interpret this Pull to produce a Stream, introducing a scope.fun <O> Pull<O, Unit>.stream(): Stream<O>
take Emits the first n elements of the input.fun <O> Pull<O, Unit>.take(n: Long): Pull<O, Pull<O, Unit>>
takeLast Emits the last n elements of the input.fun <O> Pull<O, Unit>.takeLast(n: Int): Pull<Nothing, Queue<O>>
takeThrough fun <O> Pull<O, Unit>.takeThrough(p: (O) -> Boolean): Pull<O, Pull<O, Unit>>
takeWhile fun <O> Pull<O, Unit>.takeWhile(p: (O) -> Boolean): Pull<O, Pull<O, Unit>>
takeWhile_ fun <O> Pull<O, Unit>.takeWhile_(p: (O) -> Boolean, takeFailure: Boolean): Pull<O, Pull<O, Unit>>
transformWith fun <O, R, R2> Pull<O, R>.transformWith(f: (Result<R>) -> Pull<O, R2>): Pull<O, R2>
uncons1OrNull fun <O> Pull<O, Unit>.uncons1OrNull(): Pull<Nothing, PullUncons1<O>?>
unconsLimitOrNull Like unconsOrNull, but returns a chunk of no more than n elements.fun <O> Pull<O, Unit>.unconsLimitOrNull(n: Int): Pull<Nothing, PullUncons<O>?>
unconsN Like uncons, but returns a chunk of exactly n elements, splitting chunk as necessary.fun <O> Pull<O, Unit>.unconsN(n: Int, allowFewer: Boolean = false): Pull<Nothing, PullUncons<O>?>
unconsNonEmptyOrNull Like unconsOrNull but skips over empty chunks, pulling until it can emit the first non-empty chunk.fun <O> Pull<O, Unit>.unconsNonEmptyOrNull(): Pull<Nothing, PullUncons<O>?>
unconsOrNull fun <O> Pull<O, Unit>.unconsOrNull(): Pull<Nothing, PullUncons<O>?>

Do you like Arrow?

Arrow Org
<