Skip to main content

Overview

The h8io.stages.operators package holds the stages that wrap other stages. Each applies its inner stage once per run — for the operators that drive a whole cycle of it instead, see cycles.

Decorators​

A decorator wraps one stage and keeps its type: an Alterator whose evolution is mapped so that the wrapping survives into the next generation.

OperatorWhat it changes
CompleteIfNoneturns a Yield.None with Success into one with Status.Complete
KeepLastOutputre-emits the last output when the inner stage yields none
Liftwraps the optional output into an Option, so a value is always produced
Safecatches non-fatal exceptions and reports them as errors
LocalSoftDeadlinecompletes the run once the current unit of work is out of time

Binary Operators​

These take two stages over a shared input and combine what both produced — see BinaryOperator for the shape they share.

OperatorOutputRight side
And(LO, RO)skipped when the left yields nothing
IAnd(LO, RO)always applied
OrEither[LO, RO]applied only when the left yields nothing

The inclusive-or of the family, IOr, lives in the stages-cats module, since its output type is cats.data.Ior.

Decorations​

Identity and CompleteIfSome are not stages but Decorations — functions from a stage to a stage. Identity returns it untouched; CompleteIfSome appends Complete after it with ~>. Both are singletons with a typed apply[I, O, E], so they can be passed wherever a decoration is expected without allocating one.