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] = CompleteIfNone(_)
    
    // 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] = CompleteIfNone(_)
    
    // 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 whose evolve method selects the next stage based on the current Status. The appropriate stage is selected based on the Yield.status — callers use Yield.evolve rather than dispatching on the status directly.

    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 (Status.Success) or completed (Status.Complete), with or without accumulated errors. If disposing the evolution 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.

    Exactly one of apply or skip is called per pipeline run. Resource cleanup is the responsibility of the Evolution returned from either call: Evolution.dispose releases the resources held by this stage, and after that call the stage must be considered unusable. 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 two possible states:

    • Status.Success — the stage completed normally and processing may continue.
    • Status.Complete — a unit of work has finished. Passed to Evolution when selecting the next continuation stage; enclosing alterators such as Loop or Repeat use it to end the current cycle. When errors is empty this represents clean completion; when errors is non-empty it carries one or more accumulated errors.

    Statuses form a semigroup under combine, used when merging the results of composed stages: Success is the identity element and Complete accumulates errors on combination.

    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 Evolution
  2. object Outcome

    Companion object containing the two concrete variants of Outcome.

  3. object Stage

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

  4. object Status

    Companion object containing the concrete status variants.

  5. object Yield

    Companion object containing the two concrete variants of Yield.

Ungrouped