Documentation

Init.Data.List.Control

@[specialize]
def List.mapM {m : Type u → Type v} [inst : Monad m] {α : Type w} {β : Type u} (f : α → m β) :
List α → m (List β)
Equations
@[specialize]
def List.mapA {m : Type u → Type v} [inst : Applicative m] {α : Type w} {β : Type u} (f : α → m β) :
List α → m (List β)
Equations
@[specialize]
def List.forM {m : Type u → Type v} [inst : Monad m] {α : Type w} (as : List α) (f : α → m PUnit) :
Equations
@[specialize]
def List.forA {m : Type u → Type v} [inst : Applicative m] {α : Type w} (as : List α) (f : α → m PUnit) :
Equations
@[specialize]
def List.filterAuxM {m : Type → Type v} [inst : Monad m] {α : Type} (f : α → m Bool) :
List α → List α → m (List α)
Equations
@[inline]
def List.filterM {m : Type → Type v} [inst : Monad m] {α : Type} (f : α → m Bool) (as : List α) :
m (List α)
Equations
@[inline]
def List.filterRevM {m : Type → Type v} [inst : Monad m] {α : Type} (f : α → m Bool) (as : List α) :
m (List α)
Equations
@[inline]
def List.filterMapM {m : Type u → Type v} [inst : Monad m] {α : Type u} {β : Type u} (f : α → m (Option β)) (as : List α) :
m (List β)
Equations
@[specialize]
def List.filterMapM.loop {m : Type u → Type v} [inst : Monad m] {α : Type u} {β : Type u} (f : α → m (Option β)) :
List α → List β → m (List β)
Equations
@[specialize]
def List.foldlM {m : Type u → Type 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 u → Type v} [inst : Monad m] {s : Type u} {α : Type w} (f : α → s → m s) (init : s) :
List α → m s
Equations
@[specialize]
def List.firstM {m : Type u → Type v} [inst : Monad m] [inst : Alternative m] {α : Type w} {β : Type u} (f : α → m β) :
List α → m β
Equations
@[specialize]
def List.anyM {m : Type → Type u} [inst : Monad m] {α : Type v} (f : α → m Bool) :
List α → m Bool
Equations
@[specialize]
def List.allM {m : Type → Type u} [inst : Monad m] {α : Type v} (f : α → m Bool) :
List α → m Bool
Equations
@[specialize]
def List.findM? {m : Type → Type u} [inst : Monad m] {α : Type} (p : α → m Bool) :
List α → m (Option α)
Equations
@[specialize]
def List.findSomeM? {m : Type u → Type 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 v → Type w} [inst : Monad m] (as : List α) (init : β) (f : α → β → m (ForInStep β)) :
m β
Equations
@[specialize]
def List.forIn.loop {α : Type u} {β : Type v} {m : Type v → Type w} [inst : Monad m] (f : α → β → m (ForInStep β)) :
List α → β → m β
Equations
instance List.instForInList {m : Type u_1 → Type 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_1 → Type 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_1 → Type 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
@[inline]
def List.forIn' {α : Type u} {β : Type v} {m : Type v → Type w} [inst : Monad m] (as : List α) (init : β) (f : (a : α) → a ∈ as → β → m (ForInStep β)) :
m β
Equations
@[specialize]
def List.forIn'.loop {α : Type u} {β : Type v} {m : Type v → Type w} [inst : Monad m] (as : List α) (f : (a : α) → a ∈ as → β → m (ForInStep β)) :
(x : List α) → β → (∃ bs, bs ++ x = as) → m β
Equations
  • One or more equations did not get rendered due to their size.
  • List.forIn'.loop as f [] _fun_discr x = pure _fun_discr
instance List.instForIn'ListInferInstanceMembershipInstMembershipList {m : Type u_1 → Type u_2} {α : Type u_3} :
ForIn' m (List α) α inferInstance
Equations
  • List.instForIn'ListInferInstanceMembershipInstMembershipList = { forIn' := fun {β} [Monad m] => List.forIn' }
@[simp]
theorem List.forIn'_eq_forIn {α : Type u} {β : Type v} {m : Type v → Type w} [inst : Monad m] (as : List α) (init : β) (f : α → β → m (ForInStep β)) :
(forIn' as init fun a x b => f a b) = forIn as init f
instance List.instForMList {m : Type u_1 → Type 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_1 → Type u_2} {α : Type u_3} [inst : Monad m] (f : α → m PUnit) :
@[simp]
theorem List.forM_cons {m : Type u_1 → Type u_2} {α : Type u_3} [inst : Monad m] (f : α → m PUnit) (a : α) (as : List α) :
forM (a :: as) f = do f a forM as f