Provides a cats.effect.Sync
instance for Iterant.
Provides a cats.effect.Sync
instance for Iterant.
The Halt state of the Iterant represents the completion state of a stream, with an optional exception if an error happened.
The Halt state of the Iterant represents the completion state of a stream, with an optional exception if an error happened.
Halt
is received as a final state in the iteration process.
This state cannot be followed by any other element and
represents the end of the stream.
is an error to signal at the end of the stream,
or None
in case the stream has completed normally
The Last state of the Iterant represents a completion state as an alternative to Halt(None), describing one last element.
The Last state of the Iterant represents a completion state as an alternative to Halt(None), describing one last element.
It is introduced as an optimization, being equivalent to
Next(item, F.pure(Halt(None)), F.unit)
, to avoid extra processing
in the monadic F[_]
and to short-circuit operations such as
concatenation and flatMap
.
is the last element being signaled, after which the consumer can stop the iteration
The Next state
of the Iterant represents a head
/ rest
cons pair, where the head
is a strict value.
The Next state
of the Iterant represents a head
/ rest
cons pair, where the head
is a strict value.
Note the head
being a strict value means that it is
already known, whereas the rest
is meant to be lazy and
can have asynchronous behavior as well, depending on the F
type used.
See NextCursor for a state where the head is a strict immutable list.
is the current element to be signaled
is the next state in the sequence that will produce the rest of the stream when evaluated
is a computation to be executed in case streaming is stopped prematurely, giving it a chance to do resource cleanup (e.g. close file handles)
The NextBatch state
of the Iterant represents an batch
/ rest
cons pair,
where batch
is an Iterable
type that can generate a whole batch of elements.
The NextBatch state
of the Iterant represents an batch
/ rest
cons pair,
where batch
is an Iterable
type that can generate a whole batch of elements.
is a Iterable
type that can generate elements by traversing a collection,
a standard array or any Iterable
is the next state in the sequence that will produce the rest of the stream when evaluated
is a computation to be executed in case streaming is stopped prematurely, giving it a chance to do resource cleanup (e.g. close file handles)
The NextCursor state
of the Iterant represents an batch
/ rest
cons pair,
where batch
is an Iterator
type that can generate a whole batch of elements.
The NextCursor state
of the Iterant represents an batch
/ rest
cons pair,
where batch
is an Iterator
type that can generate a whole batch of elements.
Useful for doing buffering, or by giving it an empty iterator, useful to postpone the evaluation of the next element.
is an Iterator type
that can generate elements by traversing a collection, a standard
array or any Iterator
is the next state in the sequence that will produce the rest of the stream when evaluated
is a computation to be executed in case streaming is stopped prematurely, giving it a chance to do resource cleanup (e.g. close file handles)
Builds a stream state equivalent with Iterant.NextCursor.
Builds a stream state equivalent with Iterant.NextCursor.
The Suspend state
of the Iterant represents a suspended stream to be
evaluated in the F
context. It is useful to delay the
evaluation of a stream by deferring to F
.
is the next state in the sequence that will produce the rest of the stream when evaluated
is a computation to be executed in case streaming is stopped prematurely, giving it a chance to do resource cleanup (e.g. close file handles)
Returns an IterantBuilders instance for the specified F
monadic type that can be used to build Iterant instances.
Returns an IterantBuilders instance for the specified F
monadic type that can be used to build Iterant instances.
Example:
Iterant[Task].range(0, 10)
Provides a Cats type class instances for Iterant.
Provides a Cats type class instances for Iterant.
Provides type class instances for Iterant[Coeval, A]
, based on
the default instances provided by
Coeval.catsSync.
Provides type class instances for Iterant[Coeval, A]
, based on
the default instances provided by
Coeval.catsSync.
Provides type class instances for Iterant[Task, A]
, based
on the default instances provided by
Task.catsAsync.
Provides type class instances for Iterant[Task, A]
, based
on the default instances provided by
Task.catsAsync.
Alias for suspend.
Alias for suspend.
Promote a non-strict value representing a stream to a stream of the same type, effectively delaying its initialisation.
is the by-name parameter that will generate the stream when evaluated
Returns an empty stream.
Lifts a non-strict value into the stream context, returning a stream of one element that is lazily evaluated.
Converts any standard Array
into a stream.
Converts any Scala collection.IndexedSeq
into a stream
(e.g.
Converts any Scala collection.IndexedSeq
into a stream
(e.g. Vector
).
Converts a scala.collection.Iterable
into a stream.
Converts a scala.collection.Iterator
into a stream.
Converts any Scala collection.immutable.LinearSeq
into
a stream.
Converts any scala.collection.Seq
into a stream.
Builds a stream state equivalent with Iterant.Halt.
Builds a stream state equivalent with Iterant.Halt.
The Halt state of the Iterant represents the completion state of a stream, with an optional exception if an error happened.
Halt
is received as a final state in the iteration process.
This state cannot be followed by any other element and
represents the end of the stream.
is an error to signal at the end of the stream,
or None
in case the stream has completed normally
Builds a stream state equivalent with Iterant.Last.
Builds a stream state equivalent with Iterant.Last.
The Last state of the Iterant represents a completion state as an alternative to Halt(None), describing one last element.
It is introduced as an optimization, being equivalent to
Next(item, F.pure(Halt(None)), F.unit)
, to avoid extra processing
in the monadic F[_]
and to short-circuit operations such as
concatenation and flatMap
.
is the last element being signaled, after which the consumer can stop the iteration
Builds a stream state equivalent with Iterant.NextBatch.
Builds a stream state equivalent with Iterant.NextBatch.
The NextBatch state
of the Iterant represents an batch
/ rest
cons pair,
where batch
is an Iterable
type that can generate a whole batch of elements.
is a Iterable
type that can generate elements by traversing a collection,
a standard array or any Iterable
is the next state in the sequence that will produce the rest of the stream when evaluated
is a computation to be executed in case streaming is stopped prematurely, giving it a chance to do resource cleanup (e.g. close file handles)
Builds a stream state equivalent with Iterant.NextCursor.
Builds a stream state equivalent with Iterant.NextCursor.
The NextCursor state
of the Iterant represents an batch
/ rest
cons pair,
where batch
is an Iterator
type that can generate a whole batch of elements.
Useful for doing buffering, or by giving it an empty iterator, useful to postpone the evaluation of the next element.
is an Iterator type
that can generate elements by traversing a collection, a standard
array or any Iterator
is the next state in the sequence that will produce the rest of the stream when evaluated
is a computation to be executed in case streaming is stopped prematurely, giving it a chance to do resource cleanup (e.g. close file handles)
Builds a stream state equivalent with Iterant.Next.
Builds a stream state equivalent with Iterant.Next.
The Next state
of the Iterant represents a head
/ rest
cons pair, where the head
is a strict value.
Note the head
being a strict value means that it is
already known, whereas the rest
is meant to be lazy and
can have asynchronous behavior as well, depending on the F
type used.
See NextCursor for a state where the head is a strict immutable list.
is the current element to be signaled
is the next state in the sequence that will produce the rest of the stream when evaluated
is a computation to be executed in case streaming is stopped prematurely, giving it a chance to do resource cleanup (e.g. close file handles)
Lifts a strict value into the stream context, returning a stream of one element.
Alias for now.
Returns an empty stream that ends with an error.
Builds a stream that on evaluation will produce equally spaced values in some integer interval.
Builds a stream that on evaluation will produce equally spaced values in some integer interval.
the start value of the stream
the end value of the stream (exclusive from the stream)
the increment value of the tail (must be positive or negative)
the tail producing values from, from + step, ...
up
to, but excluding until
Defers the stream generation to the underlying evaluation context (e.g.
Defers the stream generation to the underlying evaluation
context (e.g. Task
, Coeval
, IO
, etc), building a reference
equivalent with Iterant.Suspend.
The Suspend state
of the Iterant represents a suspended stream to be
evaluated in the F
context. It is useful to delay the
evaluation of a stream by deferring to F
.
is the next state in the sequence that will produce the rest of the stream when evaluated
Promote a non-strict value representing a stream to a stream of the same type, effectively delaying its initialisation.
Promote a non-strict value representing a stream to a stream of the same type, effectively delaying its initialisation.
is the by-name parameter that will generate the stream when evaluated
Builds a stream state equivalent with Iterant.NextCursor.
Builds a stream state equivalent with Iterant.NextCursor.
The Suspend state
of the Iterant represents a suspended stream to be
evaluated in the F
context. It is useful to delay the
evaluation of a stream by deferring to F
.
is the next state in the sequence that will produce the rest of the stream when evaluated
is a computation to be executed in case streaming is stopped prematurely, giving it a chance to do resource cleanup (e.g. close file handles)
Keeps calling f
and concatenating the resulting iterants for
each scala.util.Left
event emitted by the source,
concatenating the resulting iterants and generating
events out of scala.util.Right[B]
values.
Keeps calling f
and concatenating the resulting iterants for
each scala.util.Left
event emitted by the source,
concatenating the resulting iterants and generating
events out of scala.util.Right[B]
values.
Based on Phil Freeman's Stack Safety for Free.
Defines the standard Iterant builders.