ConstEvolution and StageOps

ConstEvolution is an Evolution that returns the same stage for every status. It is the result of calling .toEvolution on any stage via the StageOps extension:

import h8io.stages.*
import h8io.stages.base.*
val evo: Evolution[Int, Int, Nothing] = DoubleInt.toEvolution
// evo: Evolution[Int, Int, Nothing] = ConstEvolution(
//   stage = <function1>,
//   _dispose = h8io.stages.base.ConstEvolution$$$Lambda$19765/0x00007f5802976ab0@117a8253
// )

evo.evolve(Status.Success)
// res0: Stage[Int, Int, Nothing] = <function1>
evo.evolve(Status.complete)
// res1: Stage[Int, Int, Nothing] = <function1>

Both calls return DoubleInt. Use ConstEvolution inside operators where a fixed stage should always be the continuation, regardless of what happened in the previous run — the whole cycles family (Loop, Repeat, Reduce and Fold) returns one outwards, precisely to keep the enclosing pipeline's status from reaching the inner stage.

The overload stage.toEvolution(dispose: () => Unit) produces a ConstEvolution that calls the supplied function on disposal rather than ignoring it — useful when the lifted stage holds resources that need to be released.