Prepend an A value to the current stream.
Prepend a StreamingT[F, A] value to the current stream.
xyz
Concatenate streaming values within F[_].
Concatenate streaming values within F[_].
This method is useful when calling .flatMap over a F[StreamingT[F, A]] value.
Return a stream consisting of all but the first n
elements of
this stream.
Return a stream consisting of all but the first n
elements of
this stream.
If the current stream has n
or fewer elements, an empty stream
will be returned.
From the beginning of this stream, create a new stream which
removes all elements that fulfill the predicate f
.
From the beginning of this stream, create a new stream which
removes all elements that fulfill the predicate f
. Once an
element is found which does not fulfill the predicate, that
element and all subsequent elements will be returned.
If all elements satisfy f
, an empty stream will be returned.
If no elements satisfy f
, the current stream will be returned.
For example:
StreamingT[List, Int](1, 2, 3, 4, 5, 6, 7).dropWhile(n => n != 4)
Will result in: StreamingT[List, Int](4, 5, 6, 7)
Return true if some element of the stream satisfies the predicate, false otherwise.
Concatenate streaming values within F[_].
Concatenate streaming values within F[_].
This method is useful when calling .flatMap over a F[StreamingT[F, A]] value.
Lazily filter the stream given the predicate f
.
Eagerly search the stream from the left.
Eagerly search the stream from the left. The search ends when f returns true for some a, or the stream is exhausted. Some(a) signals a match, None means no matching items were found.
Lazily transform the stream given a function f
.
Eagerly fold the stream to a single value from the left.
Return true if every element of the stream satisfies the predicate, false otherwise.
Return true if the stream is empty, false otherwise.
Return true if the stream is empty, false otherwise.
In this case of deferred streams this will force the first element to be calculated.
Lazily transform the stream given a function f
.
Return true if the stream is non-empty, false otherwise.
Return true if the stream is non-empty, false otherwise.
In this case of deferred streams this will force the first element to be calculated.
Return a stream consisting only of the first n
elements of this
stream.
Return a stream consisting only of the first n
elements of this
stream.
If the current stream has n
or fewer elements, the entire
stream will be returned.
From the beginning of this stream, create a new stream which
takes only those elements that fulfill the predicate f
.
From the beginning of this stream, create a new stream which
takes only those elements that fulfill the predicate f
. Once an
element is found which does not fulfill the predicate, no further
elements will be returned.
If all elements satisfy f
, the current stream will be returned.
If no elements satisfy f
, an empty stream will be returned.
For example:
StreamingT[List, Int](1, 2, 3, 4, 5, 6, 7).takeWhile(n => n != 4)
Will result in: StreamingT[List, Int](1, 2, 3)
Provide a list of elements in the stream.
Provide a list of elements in the stream.
This will evaluate the stream immediately, and will hang in the case of infinite streams.
Basic string representation of a stream.
Basic string representation of a stream.
This method will not force evaluation of any lazy part of a stream. As a result, you will see at most one element (the first one).
Use .toString(n) to see the first n elements of the stream.
Deconstruct a stream into a head and tail (if available).
Deconstruct a stream into a head and tail (if available).
This method will evaluate the stream until it finds a head and tail, or until the stream is exhausted.
StreamingT[F, A] is a monad transformer which parallels Streaming[A].
However, there are a few key differences.
StreamingT[F, A]
only supports lazy evaluation ifF
does, and if theF[_]
values are constructed lazily. Also, monadic recursion onStreamingT[F, A]
is stack-safe only if monadic recursion onF
is stack-safe. Finally, sinceF
is not guaranteed to have aComonad
, it does not support many methods onStreaming[A]
which return immediate values.