Repeat

Repeat keeps re-applying the inner stage to the same input, following Status.Success transitions, until the stage signals completion. On an error-free Status.Complete the status is converted back to Success; if the Complete carries errors, those are preserved.

Unlike Loop, Repeat does not feed output back as input — the same original input is passed on every iteration. It is suited for stages like Countdown that batch a fixed number of runs and signal Complete at the end of each batch.

import h8io.stages.*
import h8io.stages.std.*
import h8io.stages.operators.*
Repeat(Countdown[String](3))("x")
// res0: Yield[String, String, Nothing] = Some(
//   out = "x",
//   status = Success,
//   evolution = ConstEvolution(
//     stage = Repeat(alterand = Countdown(i = 3L, n = 3L)),
//     _dispose = h8io.stages.operators.Repeat$$Lambda$14383/0x00007f2c9264e030@2138c258
//   )
// )

Countdown(3) processes "x" three times: Success, Success, Complete. Repeat absorbs the Complete and returns Some("x", Success, Repeat(Countdown(3))), ready for the next invocation.