This module provides the typeclass ToIterator
, which is implemented by types that can be
converted into iterators.
@[inline]
def
Std.Iterators.ToIterator.iterM
{γ : Type u_1}
{m : Type u_2 → Type u_3}
{β : Type u_2}
(x : γ)
[ToIterator x m β]
:
IterM m β
Converts x
into a monadic iterator.
Instances For
@[inline]
Converts x
into a pure iterator.
Equations
Instances For
@[inline]
def
Std.Iterators.ToIterator.ofM
{γ : Type u_1}
{m : Type w → Type u_2}
{β : Type w}
{x : γ}
(State : Type w)
(iterM : IterM m β)
:
ToIterator x m β
Creates a monadic ToIterator
instance.
Equations
- Std.Iterators.ToIterator.ofM State iterM = { State := State, iterMInternal := iterM }
Instances For
@[inline]
def
Std.Iterators.ToIterator.of
{γ : Type u_1}
{β : Type w}
{x : γ}
(State : Type w)
(iter : Iter β)
:
ToIterator x Id β
Creates a pure ToIterator
instance.
Equations
- Std.Iterators.ToIterator.of State iter = { State := State, iterMInternal := iter.toIterM }
Instances For
Instance forwarding #
If the type defined as ToIterator.State
implements an iterator typeclass, then this typeclass
should also be available when the type is syntactically visible as ToIteratorState
. The following
instances are responsible for this forwarding.
instance
Std.Iterators.instIteratorState
{γ : Type u_1}
{m : Type w → Type u_2}
{β : Type w}
{x : γ}
{State : Type w}
{iter : IterM m β}
[Iterator State m β]
:
Iterator (ToIterator.State x m) m β
Equations
instance
Std.Iterators.instIteratorCollectState
{γ : Type u_1}
{m : Type w → Type u_2}
{β : Type w}
{n : Type w → Type u_3}
{x : γ}
{State : Type w}
{iter : IterM m β}
[Iterator State m β]
[IteratorCollect State m n]
:
IteratorCollect (ToIterator.State x m) m n
Equations
instance
Std.Iterators.instIteratorCollectPartialState
{γ : Type u_1}
{m : Type w → Type u_2}
{β : Type w}
{n : Type w → Type u_3}
{x : γ}
{State : Type w}
{iter : IterM m β}
[Iterator State m β]
[IteratorCollectPartial State m n]
:
IteratorCollectPartial (ToIterator.State x m) m n
instance
Std.Iterators.instIteratorLoopState
{γ : Type u_1}
{m : Type w → Type u_2}
{β : Type w}
{n : Type w → Type u_3}
{x : γ}
{State : Type w}
{iter : IterM m β}
[Iterator State m β]
[IteratorLoop State m n]
:
IteratorLoop (ToIterator.State x m) m n
Equations
instance
Std.Iterators.instIteratorLoopPartialState
{γ : Type u_1}
{m : Type w → Type u_2}
{β : Type w}
{n : Type w → Type u_3}
{x : γ}
{State : Type w}
{iter : IterM m β}
[Iterator State m β]
[IteratorLoopPartial State m n]
:
IteratorLoopPartial (ToIterator.State x m) m n
Equations
instance
Std.Iterators.instIteratorSizeState
{γ : Type u_1}
{m : Type w → Type u_2}
{β : Type w}
{x : γ}
{State : Type w}
{iter : IterM m β}
[Iterator State m β]
[IteratorSize State m]
:
IteratorSize (ToIterator.State x m) m
Equations
instance
Std.Iterators.instIteratorSizePartialState
{γ : Type u_1}
{m : Type w → Type u_2}
{β : Type w}
{x : γ}
{State : Type w}
{iter : IterM m β}
[Iterator State m β]
[IteratorSizePartial State m]
:
IteratorSizePartial (ToIterator.State x m) m