Packages

final case class Loop[T, +E](alterand: Endo[T, E]) extends Decorator[T, T, E] with Product with Serializable

A decorator that feeds the output of each successful step back as the input of the next, effectively looping the inner endomorphic stage until it stops.

The tail-recursive loop works as follows:

  • h8io.stages.Status.Success + h8io.stages.Yield.Some: the output becomes the new input and the loop continues with the onSuccess continuation.
  • h8io.stages.Status.Success + h8io.stages.Yield.None: no output was produced; the loop stops and emits Yield.None(Success, Loop(onComplete)).
  • h8io.stages.Status.Complete with no errors: the loop stops, converts the status back to Success, and selects the Complete continuation for the next outer invocation.
  • h8io.stages.Status.Complete with errors: the loop stops, preserves the errors, and selects the Complete continuation for the next outer invocation.

This makes Loop suitable for in-process iterative computations (e.g., fixed-point iterations) where the result of one step seeds the next.

T

the value type (both input and output)

E

the error type (covariant)

alterand

the inner endomorphic stage T → T to loop

Source
Loop.scala
Linear Supertypes
Serializable, Product, Equals, Alterator[Stage[T, T, E], T, T, E], Stage[T, T, E], (T) => Yield[T, T, E], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Loop
  2. Serializable
  3. Product
  4. Equals
  5. Alterator
  6. Stage
  7. Function1
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Loop(alterand: Endo[T, E])

    alterand

    the inner endomorphic stage T → T to loop

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. val alterand: Endo[T, E]

    The wrapped stage whose behavior is modified by this operator.

    The wrapped stage whose behavior is modified by this operator.

    Definition Classes
    LoopAlterator
  5. def andThen[A](g: (Yield[T, T, E]) => A): (T) => A
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  6. def apply(in: T): Yield[T, T, E]

    Applies this stage to the given input, producing a Yield.

    Applies this stage to the given input, producing a Yield.

    in

    the input value

    returns

    a Yield containing the optional output, status, and evolution

    Definition Classes
    LoopStage → Function1
  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  9. def compose[A](g: (A) => T): (A) => Yield[T, T, E]
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. final def execute(in: T): Outcome[T, E]

    Executes this stage end-to-end and returns a plain Outcome.

    Executes this stage end-to-end and returns a plain Outcome.

    Internally this method:

    1. Applies the stage to in, obtaining a Yield.
    2. Disposes the Evolution carried by the Yield — since execute is a terminal operation, the continuation is not needed and the resources held by this stage must be released immediately.
    3. Wraps the result in an Outcome.Some or Outcome.None.

    Disposal failures do not prevent the result from being returned. Any non-fatal exception raised by Evolution.dispose is captured in Outcome.disposeFailure and the outcome is still produced. Fatal exceptions are not caught and will propagate.

    in

    the input value

    returns

    Outcome.Some if this stage produced an output, Outcome.None otherwise

    Definition Classes
    Stage
    Annotations
    @inline()
  12. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  16. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  17. def productElementNames: Iterator[String]
    Definition Classes
    Product
  18. def skip(): Evolution[T, T, E]

    Returns the Evolution for this stage without processing any input.

    Returns the Evolution for this stage without processing any input.

    Any stage that participates in a pipeline run but does not process the current input must call skip() instead of apply. Common triggers: an upstream stage produced no output (Yield.None), or a non-inclusive binary operation excluded this branch. The stage must return its Evolution as it would have appeared had it run, but must not perform any side effects or consume input.

    See the Lifecycle section in Stage for the full contract.

    returns

    the Evolution representing how the pipeline should continue from this stage

    Definition Classes
    LoopStage
  19. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  20. def toString(): String
    Definition Classes
    Function1 → AnyRef → Any
  21. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  22. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  23. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  24. final def ~>[_O, _E >: E](that: Stage[T, _O, _E]): Stage[T, _O, _E]

    Composes this stage with that, producing a new stage that feeds the output of this stage into that.

    Composes this stage with that, producing a new stage that feeds the output of this stage into that.

    The resulting Stage.AndThen feeds the output of this stage into that. If this stage produces an output, the statuses and evolutions of both stages are merged; if it produces no output, only the evolutions are composed and that is not invoked for the current input.

    _O

    the output type of the composed pipeline

    _E

    the combined error type (must be a supertype of E)

    that

    the stage to execute after this one

    returns

    a composed stage this ~> that

    Definition Classes
    Stage
    Annotations
    @inline()

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 Serializable

Inherited from Product

Inherited from Equals

Inherited from Alterator[Stage[T, T, E], T, T, E]

Inherited from Stage[T, T, E]

Inherited from (T) => Yield[T, T, E]

Inherited from AnyRef

Inherited from Any

Ungrouped