A Step
describes the next step of the sequence construction. Done
indicates the
sequence is finished. Skip
indicates the sequence continues with another state
without producing the next element yet. Yield
outputs an element and introduces a
new state.
Modifying 's
doesn't violate any internal invariants, but it may violate some
undocumented expectations. For example, one might expect that producing an element
from the same point in the sequence would always give the same value, but if the state
can mutate, that is not so.