Documentation

Std.Data.Iterators.Producers.Monadic.Array

Array iterator #

This module provides an iterator for arrays that is accessible via Array.iterM.

@[unbox]
structure Std.Iterators.ArrayIterator (α : Type w) :

The underlying state of a list iterator. Its contents are internal and should not be used by downstream users of the library.

  • array : Array α

    Internal implementation detail of the iterator library.

  • pos : Nat

    Internal implementation detail of the iterator library.

Instances For
    @[inline]
    def Array.iterFromIdxM {α : Type w} (array : Array α) (m : Type w → Type w') (pos : Nat) [Pure m] :

    Returns a finite monadic iterator for the given array starting at the given index. The iterator yields the elements of the array in order and then terminates.

    The pure version of this iterator is Array.iterFromIdx.

    Termination properties:

    • Finite instance: always
    • Productive instance: always
    Equations
      Instances For
        @[inline]
        def Array.iterM {α : Type w} (array : Array α) (m : Type w → Type w') [Pure m] :

        Returns a finite monadic iterator for the given array. The iterator yields the elements of the array in order and then terminates. There are no side effects.

        The pure version of this iterator is Array.iter.

        Termination properties:

        • Finite instance: always
        • Productive instance: always
        Equations
          Instances For
            @[inline]
            Equations
              @[inline]
              instance Std.Iterators.instIteratorCollectArrayIteratorOfMonad {m : Type w → Type w'} {n : Type w → Type u_1} {α : Type w} [Monad m] [Monad n] :
              Equations
                @[inline]
                Equations
                  @[inline]
                  instance Std.Iterators.instIteratorLoopArrayIteratorOfMonad {m : Type w → Type w'} {n : Type w → Type u_1} {α : Type w} [Monad m] [Monad n] :
                  Equations
                    @[inline]
                    Equations