Packages

  • package root
    Definition Classes
    root
  • package h8io
    Definition Classes
    root
  • package stages
    Definition Classes
    h8io
  • package base

    Type aliases used throughout the lib module for describing stage transformations.

    Type aliases used throughout the lib module for describing stage transformations.

    // A decorator wraps a Stage[I, O, E] and returns another Stage[I, O, E]:
    val myDecorator: Decorator[String, Int, Nothing] = BreakIfNone(_)
    
    // An alteration converts any Stage to a (possibly different) Stage:
    val myAlt: Alteration[Stage[String, Int, Nothing], Stage[String, Option[Int], Nothing]] = Lift(_)
  • package cats
  • package examples
  • package operators
  • package projections
  • package std
  • Evolution
  • Outcome
  • Stage
  • Status
  • Yield
p

h8io

stages

package stages

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. Protected

Package Members

  1. package base

    Type aliases used throughout the lib module for describing stage transformations.

    Type aliases used throughout the lib module for describing stage transformations.

    // A decorator wraps a Stage[I, O, E] and returns another Stage[I, O, E]:
    val myDecorator: Decorator[String, Int, Nothing] = BreakIfNone(_)
    
    // An alteration converts any Stage to a (possibly different) Stage:
    val myAlt: Alteration[Stage[String, Int, Nothing], Stage[String, Option[Int], Nothing]] = Lift(_)
  2. package cats
  3. package examples
  4. package operators
  5. package projections
  6. package std

Type Members

  1. trait Evolution[-I, +O, +E] extends AnyRef

    A strategy that selects the next Stage to use when the pipeline is ready to re-process, based on the Status carried by the Yield returned from the most recent stage application.

    A strategy that selects the next Stage to use when the pipeline is ready to re-process, based on the Status carried by the Yield returned from the most recent stage application. In a composed pipeline, this refers to the combined Yield produced for the current input.

    Every Yield carries an Evolution that has three branches:

    The branch is selected by Status.apply inside Stage.execute, so callers never need to dispatch on the status themselves.

    Evolution is contravariant in I and covariant in O and E, mirroring the variance of the Stage values it returns.

    I

    the input type consumed by the returned stages (contravariant)

    O

    the output type produced by the returned stages (covariant)

    E

    the error type (covariant)

  2. sealed trait Outcome[+O, +E] extends AnyRef

    The final result of executing a Stage via Stage.execute.

    The final result of executing a Stage via Stage.execute.

    Unlike Yield, an Outcome does not carry an Evolution; it is the terminal value returned to the caller after the pipeline has finished processing a single input. The Status indicates whether execution succeeded, completed, or produced errors. If disposing the selected next stage fails, the exception is recorded in Outcome.disposeFailure without preventing the outcome from being returned.

    O

    the output type (covariant)

    E

    the error type (covariant)

  3. trait Stage[-I, +O, +E] extends (I) => Yield[I, O, E]

    A single processing unit in a pipeline that transforms input values into Yield results.

    A single processing unit in a pipeline that transforms input values into Yield results.

    A Stage produces a Yield that carries an optional output of type O, a Status, and an Evolution strategy describing how to continue processing.

    Stages are contravariant in I and covariant in both O and E, which allows them to be composed safely in a pipeline via the ~> operator.

    Lifecycle

    Every Stage instance participates in exactly one of these lifecycle paths during a pipeline run:

    • Active: apply is called with an input value. The stage processes it and returns a Yield.
    • Skipped: skip is called when the stage is bypassed — for example, because an upstream stage produced no output, or because of a non-inclusive binary operation. The stage must return its Evolution without performing any processing.
    • Disposed: dispose is called when the pipeline is torn down. All stages in the pipeline receive this call, regardless of whether they were active or skipped.

    Exactly one of apply or skip is called per pipeline run; dispose is called once when the pipeline is released. Fatal exceptions are not accounted for by this contract.

    Example — building a pipeline:

    val parse: Stage[String, Int, String]  = ...
    val double: Stage[Int, Int, String]    = ...
    val pipeline: Stage[String, Int, String] = parse ~> double
    I

    the input type (contravariant)

    O

    the output type (covariant)

    E

    the error type (covariant)

  4. sealed trait Status[+E] extends AnyRef

    The execution status produced by a Stage.

    The execution status produced by a Stage.

    A Status travels alongside the output (or absence of output) in a Yield and is accumulated as stages are composed. There are three possible states:

    • Status.Success — the stage completed normally and processing may continue.
    • Status.Complete — the pipeline has finished successfully; no further input should be processed.
    • Status.Error — one or more errors occurred; the pipeline should stop and report them.

    Statuses form a semigroup under the internal ++ operation used when merging the results of composed stages: Success is the identity element, Complete dominates Success but yields to Error, and Error dominates all.

    E

    the error type (covariant)

  5. sealed trait Yield[-I, +O, +E] extends AnyRef

    The immediate result returned by a Stage when applied to an input value.

    The immediate result returned by a Stage when applied to an input value.

    A Yield carries three pieces of information:

    • An optional output value (O), present only in Yield.Some.
    • A Status representing the outcome of this stage invocation.
    • An Evolution that decides which stage to use when re-processing based on the status.

    The type parameters follow the same variance rules as Stage: contravariant in I (the input consumed by the continuation stages stored in the evolution) and covariant in O and E.

    I

    the input type consumed by the Evolution stages (contravariant)

    O

    the output type (covariant)

    E

    the error type (covariant)

Value Members

  1. object Outcome

    Companion object containing the two concrete variants of Outcome.

  2. object Stage

    Companion object for Stage, containing type aliases and the AndThen implementation.

  3. object Status

    Companion object containing the three concrete status variants.

  4. object Yield

    Companion object containing the two concrete variants of Yield.

Ungrouped