Concrete Streaming[A] types:
Concrete Streaming[A] types:
a
.Cons represents a lazy, possibly infinite stream of values.
Eval[_] is used to represent possible laziness (via Now, Later,
and Always). The head of Cons
is eager -- a lazy head can be
represented using Wait(Always(...))
or Wait(Later(...))
.
Create a stream from two or more values.
Create a stream consisting of a single value.
Prepend a value to an Eval[Streaming[A]].
Prepend a value to a stream.
Continually return a constant value.
Defer stream creation.
Defer stream creation.
Given an expression which creates a stream, this method defers that creation, allowing the head (if any) to be lazy.
Create an empty stream of type A.
Stream of integers starting at n.
Create a stream from an iterable.
Create a stream from an iterable.
The stream will be eagerly evaluated.
Create a stream from an iterator.
Create a stream from an iterator.
The stream will be created lazily, to support potentially large (or infinite) iterators. Iterators passed to this method should not be used elsewhere -- doing so will result in problems.
The use case for this method is code like .fromIterable, which creates an iterator for the express purpose of calling this method.
Create a stream from a list.
Create a stream from a list.
The stream will be eagerly evaluated.
Create a stream from a vector.
Create a stream from a vector.
The stream will be eagerly evaluated.
Produce an infinite stream of values given an initial value and a tranformation function.
Provide a stream of integers starting with start
and ending
with end
(i.e.
Provide a stream of integers starting with start
and ending
with end
(i.e. inclusive).
Create a self-referential stream.
Contains various Stream-specific syntax.
Contains various Stream-specific syntax.
To eanble this, say:
import cats.data.Stream.syntax._
This provides the %:: and %::: operators for constructing Streams lazily, and the %:: extract to use when pattern matching on Streams.
Continually return the result of a thunk.
Continually return the result of a thunk.
This method only differs from continually
in that the thunk may
not be pure. For this reason (and unlike continually), this
stream is memoized to ensure that repeated traversals produce the
same results.
Produce a stream given an "unfolding" function.
Produce a stream given an "unfolding" function.
None represents an empty stream. Some(a) reprsents an initial element, and we can compute the tail (if any) via f(a).
Create a stream from an Eval[Streaming[A]]
value.
Create a stream from an Eval[Streaming[A]]
value.
Given an expression which creates a stream, this method defers that creation, allowing the head (if any) to be lazy.