Overview

The h8io.stages.cycles package hosts operators that drive a whole cycle of the inner stage within a single outer run: on every apply they keep re-applying the inner stage's generations — tail-recursively, without growing the stack — until the stage signals the end of the cycle with Status.Complete.

Loop feeds each output back as the next input; Repeat re-applies the stage to the same input; Reduce re-applies the stage to the same input like Repeat and folds every output into an accumulator with a binary operation stage; Fold does the same as Reduce, but seeded from the outer input, so — unlike Reduce — it always has a value to yield. All of them absorb an error-free Complete into a Success and preserve accumulated errors.

Feeding the output back gives Loop one more way out of the cycle: an iteration that produces no output leaves it with nothing to feed, so the cycle ends there too. For the other three the status alone decides — an iteration yielding nothing with Success keeps them spinning.

The family shares one lifecycle contract: