it.IsPlausibleNthOutputStep n step is the proposition that according to the
IsPlausibleStep relation, it is plausible that step returns the step in which the n-th value
of it is emitted, or .done if it can plausibly terminate before emitting n values.
- zero_yield
{α β : Type w}
{m : Type w → Type w'}
[Iterator α m β]
{it' : IterM m β}
{out : β}
{it : IterM m β}
: it.IsPlausibleStep (IterStep.yield it' out) → IsPlausibleNthOutputStep 0 it (IterStep.yield it' out)
If
itplausibly yields in its immediate next step, this step is a plausible0-th output step. - done {α β : Type w} {m : Type w → Type w'} [Iterator α m β] {n : Nat} {it : IterM m β} : it.IsPlausibleStep IterStep.done → IsPlausibleNthOutputStep n it IterStep.done
- yield
{α β : Type w}
{m : Type w → Type w'}
[Iterator α m β]
{n : Nat}
{it it' : IterM m β}
{out : β}
{step : IterStep (IterM m β) β}
: it.IsPlausibleStep (IterStep.yield it' out) →
IsPlausibleNthOutputStep n it' step → IsPlausibleNthOutputStep (n + 1) it step
If
itplausibly yields in its immediate next step, the successor iterator beingit', and ifstepis a plausiblen-th output step ofit', thenstepis a plausiblen + 1-th output step ofit. - skip
{α β : Type w}
{m : Type w → Type w'}
[Iterator α m β]
{n : Nat}
{it it' : IterM m β}
{step : IterStep (IterM m β) β}
: it.IsPlausibleStep (IterStep.skip it') → IsPlausibleNthOutputStep n it' step → IsPlausibleNthOutputStep n it step
If
itplausibly skips in its immediate next step, the successor iterator beingit', and ifstepis a plausiblen-th output step ofit', thenstepis also a plausiblen-th output step ofit.
Instances For
IteratorAccess α m provides efficient implementations for random access or iterators that support
it. it.nextAtIdx? n either returns the step in which the n-th value of it is emitted
(necessarily of the form .yield _ _) or .done if it terminates before emitting the n-th
value.
For monadic iterators, the monadic effects of this operation may differ from manually iterating
to the n-th value because nextAtIdx? can take shortcuts. By the signature, the return value
is guaranteed to plausible in the sense of IterM.IsPlausibleNthOutputStep.
This class is experimental and users of the iterator API should not explicitly depend on it.
Instances
Returns the step in which it yields its n-th element, or .done if it terminates earlier.
In contrast to step, this function will always return either .yield or .done but never a
.skip step.
For monadic iterators, the monadic effects of this operation may differ from manually iterating
to the n-th value because nextAtIdx? can take shortcuts. By the signature, the return value
is guaranteed to plausible in the sense of IterM.IsPlausibleNthOutputStep.
This function is only available for iterators that explicitly support it by implementing
the IteratorAccess typeclass.
Equations
Instances For
Returns the n-th value emitted by it, or none if it terminates earlier.
For monadic iterators, the monadic effects of this operation may differ from manually iterating
to the n-th value because atIdx? can take shortcuts. By the signature, the return value
is guaranteed to plausible in the sense of IterM.IsPlausibleNthOutputStep.
This function is only available for iterators that explicitly support it by implementing
the IteratorAccess typeclass.
Equations
- One or more equations did not get rendered due to their size.