Packages

final class Scan[S, -I, +O] extends AnyRef

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.

Source
Scan.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Scan
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Scan(initial: S, transform_: AndThen[(S, I), (S, Chunk[O])], onComplete_: AndThen[S, Chunk[O]])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def andThen[S2, O2](that: Scan[S2, O, O2]): Scan[(S, S2), I, O2]

    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.

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def choice[S2, I2, O2 >: O](that: Scan[S2, I2, O2]): Scan[(S, S2), Either[I, I2], O2]

    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.

  7. def choose[S2, I2, O2](t: Scan[S2, I2, O2]): Scan[(S, S2), Either[I, I2], Either[O, O2]]

    Like choice but the output elements are kept separate.

  8. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  9. def contramap[I2](f: (I2) => I): Scan[S, I2, O]

    Returns a new scan which transforms input values using the supplied function.

  10. def dimap[I2, O2](g: (I2) => I)(f: (O) => O2): Scan[S, I2, O2]
  11. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  13. def first[A]: Scan[S, (I, A), (O, A)]

    Returns a scan that inputs/outputs pairs of elements, with I and O in the first element of the pair.

  14. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  15. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  16. def imapState[S2](g: (S) => S2)(f: (S2) => S): Scan[S2, I, O]

    Transforms the state type.

  17. val initial: S
  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. def left[A]: Scan[S, Either[I, A], Either[O, A]]

    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.

  20. def lens[I2, O2](get: (I2) => I, set: (I2, O) => O2): Scan[S, I2, O2]

    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.

  21. def map[O2](f: (O) => O2): Scan[S, I, O2]

    Returns a new scan which transforms output values using the supplied function.

  22. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  23. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  24. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  25. def onComplete(s: S): Chunk[O]

    Completion function.

  26. def right[A]: Scan[S, Either[A, I], Either[A, O]]

    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.

  27. def second[A]: Scan[S, (A, I), (A, O)]

    Returns a scan that inputs/outputs pairs of elements, with I and O in the second element of the pair.

  28. def semilens[I2, O2](extract: (I2) => Either[O2, I], inject: (I2, O) => O2): Scan[S, I2, O2]

    Like lens but some elements are passed to the output (skipping the original scan) while other elements are lensed through the original scan.

  29. def semipass[I2, O2 >: O](extract: (I2) => Either[O2, I]): Scan[S, I2, O2]

    Like semilens but the elements of the original scan are output directly.

  30. def step(i: I): (Scan[S, I, O], Chunk[O])

    Steps this scan by a single input, returning a new scan and the output elements computed from the input.

  31. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  32. def toPipe[F[_]]: (Stream[F, I]) => Stream[F, O]

    Converts this scan to a pipe.

  33. def toString(): String
    Definition Classes
    AnyRef → Any
  34. def transform(s: S, i: I): (S, Chunk[O])

    Transformation function.

  35. def transformAccumulate(s: S, c: Chunk[I]): (S, Chunk[O])

    Chunk form of transform.

  36. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  37. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  38. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from AnyRef

Inherited from Any

Ungrouped