A stateful transformation of the elements of a stream.
A scan is primarily represented as a function (S, I) => (S, Chunk[O])
. Scans also have an initial state value of type S
and the ability to emit elements upon completion via a function S => Chunk[O]
.
A scan is built up incrementally via various combinators and then converted to a pipe via .toPipe
. For example, s.through(Scan.lift(identity).toPipe) == s
.
A scan is much less powerful than a pull. Scans cannot evaluate effects or terminate early. These limitations allow combinators that are not possible on pulls though. For example, the first method converts a Scan[S, I, O]
to a Scan[S, (I, A), (O, A)]
. Critically, this method relies on the ability to feed a single I
to the original scan and collect the resulting O
values, pairing each O
with the A
that was paired with I
.
Attributes
- Companion
- object
- Source
- Scan.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
Value members
Concrete methods
Composes the supplied scan with this scan.
Composes the supplied scan with this scan.
The resulting scan maintains the state of each of the input scans independently.
Attributes
- Source
- Scan.scala
Combines this scan with the supplied scan such that elements on the left are fed through this scan while elements on the right are fed through the suppplied scan.
Combines this scan with the supplied scan such that elements on the left are fed through this scan while elements on the right are fed through the suppplied scan. The outputs are joined together.
Attributes
- Source
- Scan.scala
Like choice but the output elements are kept separate.
Returns a new scan which transforms input values using the supplied function.
Returns a new scan which transforms input values using the supplied function.
Attributes
- Source
- Scan.scala
Returns a scan that inputs/outputs pairs of elements, with I
and O
in the first element of the pair.
Returns a scan that inputs/outputs pairs of elements, with I
and O
in the first element of the pair.
Attributes
- Source
- Scan.scala
Transforms the state type.
Returns a scan that wraps the inputs/outputs with Either
.
Returns a scan that wraps the inputs/outputs with Either
. Elements on the left pass through the original scan while elements on the right pass through directly.
Attributes
- Source
- Scan.scala
Returns a new scan with transformed input and output types.
Returns a new scan with transformed input and output types.
Upon receiving an I2
, get
is invoked and the result is fed to the original scan. For each output value, set
is invoked with the original I2
input and the computed O
, yielding a new output of type O2
.
Attributes
- Source
- Scan.scala
Returns a new scan which transforms output values using the supplied function.
Returns a new scan which transforms output values using the supplied function.
Attributes
- Source
- Scan.scala
Completion function.
Returns a scan that wraps the inputs/outputs with Either
.
Returns a scan that wraps the inputs/outputs with Either
. Elements on the right pass through the original scan while elements on the left pass through directly.
Attributes
- Source
- Scan.scala
Returns a scan that inputs/outputs pairs of elements, with I
and O
in the second element of the pair.
Returns a scan that inputs/outputs pairs of elements, with I
and O
in the second element of the pair.
Attributes
- Source
- Scan.scala
Like lens but some elements are passed to the output (skipping the original scan) while other elements are lensed through the original scan.
Like lens but some elements are passed to the output (skipping the original scan) while other elements are lensed through the original scan.
Attributes
- Source
- Scan.scala
Like semilens but the elements of the original scan are output directly.
Like semilens but the elements of the original scan are output directly.
Attributes
- Source
- Scan.scala
Steps this scan by a single input, returning a new scan and the output elements computed from the input.
Steps this scan by a single input, returning a new scan and the output elements computed from the input.
Attributes
- Source
- Scan.scala
Converts this scan to a pipe.
Transformation function.
Chunk form of transform.
Concrete fields
Attributes
- Source
- Scan.scala