Documentation

Init.Data.List.Control

@[specialize]
def List.mapM {m : Type uType v} [inst : Monad m] {α : Type w} {β : Type u} (f : αm β) :
List αm (List β)
Equations
@[specialize]
def List.mapA {m : Type uType v} [inst : Applicative m] {α : Type w} {β : Type u} (f : αm β) :
List αm (List β)
Equations
@[specialize]
def List.forM {m : Type uType v} [inst : Monad m] {α : Type w} (as : List α) (f : αm PUnit) :
Equations
@[specialize]
def List.forA {m : Type uType v} [inst : Applicative m] {α : Type w} (as : List α) (f : αm PUnit) :
Equations
@[specialize]
def List.filterAuxM {m : TypeType v} [inst : Monad m] {α : Type} (f : αm Bool) :
List αList αm (List α)
Equations
@[inline]
def List.filterM {m : TypeType v} [inst : Monad m] {α : Type} (f : αm Bool) (as : List α) :
m (List α)
Equations
@[inline]
def List.filterRevM {m : TypeType v} [inst : Monad m] {α : Type} (f : αm Bool) (as : List α) :
m (List α)
Equations
@[inline]
def List.filterMapM {m : Type uType v} [inst : Monad m] {α : Type u} {β : Type u} (f : αm (Option β)) (as : List α) :
m (List β)
Equations
@[specialize]
def List.filterMapM.loop {m : Type uType v} [inst : Monad m] {α : Type u} {β : Type u} (f : αm (Option β)) :
List αList βm (List β)
Equations
@[specialize]
def List.foldlM {m : Type uType v} [inst : Monad m] {s : Type u} {α : Type w} (f : sαm s) (init : s) :
List αm s
Equations
@[specialize]
def List.foldrM {m : Type uType v} [inst : Monad m] {s : Type u} {α : Type w} (f : αsm s) (init : s) :
List αm s
Equations
@[specialize]
def List.firstM {m : Type uType v} [inst : Monad m] [inst : Alternative m] {α : Type w} {β : Type u} (f : αm β) :
List αm β
Equations
@[specialize]
def List.anyM {m : TypeType u} [inst : Monad m] {α : Type v} (f : αm Bool) :
List αm Bool
Equations
@[specialize]
def List.allM {m : TypeType u} [inst : Monad m] {α : Type v} (f : αm Bool) :
List αm Bool
Equations
@[specialize]
def List.findM? {m : TypeType u} [inst : Monad m] {α : Type} (p : αm Bool) :
List αm (Option α)
Equations
@[specialize]
def List.findSomeM? {m : Type uType v} [inst : Monad m] {α : Type w} {β : Type u} (f : αm (Option β)) :
List αm (Option β)
Equations
@[inline]
def List.forIn {α : Type u} {β : Type v} {m : Type vType w} [inst : Monad m] (as : List α) (init : β) (f : αβm (ForInStep β)) :
m β
Equations
@[specialize]
def List.forIn.loop {α : Type u} {β : Type v} {m : Type vType w} [inst : Monad m] (f : αβm (ForInStep β)) :
List αβm β
Equations
instance List.instForInList {m : Type u_1Type u_2} {α : Type u_3} :
ForIn m (List α) α
Equations
  • List.instForInList = { forIn := fun {β} [Monad m] => List.forIn }
@[simp]
theorem List.forIn_nil {m : Type u_1Type u_2} {α : Type u_3} {β : Type u_1} [inst : Monad m] (f : αβm (ForInStep β)) (b : β) :
forIn [] b f = pure b
@[simp]
theorem List.forIn_cons {m : Type u_1Type u_2} {α : Type u_3} {β : Type u_1} [inst : Monad m] (f : αβm (ForInStep β)) (a : α) (as : List α) (b : β) :
forIn (a :: as) b f = do let x ← f a b match x with | ForInStep.done b => pure b | ForInStep.yield b => forIn as b f
instance List.instForMList {m : Type u_1Type u_2} {α : Type u_3} :
ForM m (List α) α
Equations
  • List.instForMList = { forM := fun [Monad m] => List.forM }
@[simp]
theorem List.forM_nil {m : Type u_1Type u_2} {α : Type u_3} [inst : Monad m] (f : αm PUnit) :
@[simp]
theorem List.forM_cons {m : Type u_1Type u_2} {α : Type u_3} [inst : Monad m] (f : αm PUnit) (a : α) (as : List α) :
forM (a :: as) f = do f a forM as f