Documentation

Std.Data.DHashMap.Internal.AssocList.Basic

This is an internal implementation file of the hash map. Users of the hash map should not rely on the contents of this file.

Note that some functions in this file (in particular, foldrM, foldr, toList, replace, and erase) are not tail-recursive. This is not a problem because they are only used internally by HashMap, where AssocList is always small. Before making this API public, we would need to add @[csimp] lemmas for tail-recursive implementations.

File contents: Operations on associative lists

inductive Std.DHashMap.Internal.AssocList (α : Type u) (β : αType v) :
Type (max u v)

AssocList α β is "the same as" List (α × β), but flattening the structure leads to one fewer pointer indirection (in the current code generator).

  • nil {α : Type u} {β : αType v} : AssocList α β

    Internal implementation detail of the hash map

  • cons {α : Type u} {β : αType v} (key : α) (value : β key) (tail : AssocList α β) : AssocList α β

    Internal implementation detail of the hash map

Instances For
@[specialize #[]]
def Std.DHashMap.Internal.AssocList.foldlM {α : Type u} {β : αType v} {δ : Type w} {m : Type w → Type w} [Monad m] (f : δ(a : α) → β am δ) (init : δ) :
AssocList α βm δ

Internal implementation detail of the hash map

Equations
@[inline]
def Std.DHashMap.Internal.AssocList.foldl {α : Type u} {β : αType v} {δ : Type w} (f : δ(α : α) → β αδ) (init : δ) (as : AssocList α β) :
δ

Internal implementation detail of the hash map

Equations
@[specialize #[]]
def Std.DHashMap.Internal.AssocList.foldrM {α : Type u} {β : αType v} {δ : Type w} {m : Type w → Type w} [Monad m] (f : (a : α) → β aδm δ) (init : δ) :
AssocList α βm δ

Internal implementation detail of the hash map

Equations
@[inline]
def Std.DHashMap.Internal.AssocList.foldr {α : Type u} {β : αType v} {δ : Type w} (f : (a : α) → β aδδ) (init : δ) (as : AssocList α β) :
δ

Internal implementation detail of the hash map

Equations
@[inline]
def Std.DHashMap.Internal.AssocList.forM {α : Type u} {β : αType v} {m : Type w → Type w} [Monad m] (f : (a : α) → β am PUnit) (as : AssocList α β) :

Internal implementation detail of the hash map

Equations
@[inline]
def Std.DHashMap.Internal.AssocList.forInStep {α : Type u} {β : αType v} {δ : Type w} {m : Type w → Type w} [Monad m] (as : AssocList α β) (init : δ) (f : (a : α) → β aδm (ForInStep δ)) :
m (ForInStep δ)

Internal implementation detail of the hash map

Equations
@[specialize #[]]
def Std.DHashMap.Internal.AssocList.forInStep.go {α : Type u} {β : αType v} {δ : Type w} {m : Type w → Type w} [Monad m] (f : (a : α) → β aδm (ForInStep δ)) :
AssocList α βδm (ForInStep δ)
Equations
def Std.DHashMap.Internal.AssocList.toList {α : Type u} {β : αType v} :
AssocList α βList ((a : α) × β a)

Internal implementation detail of the hash map

Equations
def Std.DHashMap.Internal.AssocList.length {α : Type u} {β : αType v} (l : AssocList α β) :

Internal implementation detail of the hash map

Equations
def Std.DHashMap.Internal.AssocList.get? {α : Type u} {β : Type v} [BEq α] (a : α) :
(AssocList α fun (x : α) => β)Option β

Internal implementation detail of the hash map

Equations
def Std.DHashMap.Internal.AssocList.get {α : Type u} {β : Type v} [BEq α] (a : α) (l : AssocList α fun (x : α) => β) :
contains a l = trueβ

Internal implementation detail of the hash map

Equations
def Std.DHashMap.Internal.AssocList.getCast {α : Type u} {β : αType v} [BEq α] [LawfulBEq α] (a : α) (l : AssocList α β) :
contains a l = trueβ a

Internal implementation detail of the hash map

Equations
def Std.DHashMap.Internal.AssocList.getKey {α : Type u} {β : αType v} [BEq α] (a : α) (l : AssocList α β) :
contains a l = trueα

Internal implementation detail of the hash map

Equations
def Std.DHashMap.Internal.AssocList.getCast! {α : Type u} {β : αType v} [BEq α] [LawfulBEq α] (a : α) [Inhabited (β a)] :
AssocList α ββ a

Internal implementation detail of the hash map

Equations
def Std.DHashMap.Internal.AssocList.get! {α : Type u} {β : Type v} [BEq α] [Inhabited β] (a : α) :
(AssocList α fun (x : α) => β)β

Internal implementation detail of the hash map

Equations
def Std.DHashMap.Internal.AssocList.getKey! {α : Type u} {β : αType v} [BEq α] [Inhabited α] (a : α) :
AssocList α βα

Internal implementation detail of the hash map

Equations
def Std.DHashMap.Internal.AssocList.getCastD {α : Type u} {β : αType v} [BEq α] [LawfulBEq α] (a : α) (fallback : β a) :
AssocList α ββ a

Internal implementation detail of the hash map

Equations
def Std.DHashMap.Internal.AssocList.getD {α : Type u} {β : Type v} [BEq α] (a : α) (fallback : β) :
(AssocList α fun (x : α) => β)β

Internal implementation detail of the hash map

Equations
def Std.DHashMap.Internal.AssocList.getKeyD {α : Type u} {β : αType v} [BEq α] (a fallback : α) :
AssocList α βα

Internal implementation detail of the hash map

Equations
def Std.DHashMap.Internal.AssocList.replace {α : Type u} {β : αType v} [BEq α] (a : α) (b : β a) :
AssocList α βAssocList α β

Internal implementation detail of the hash map

Equations
def Std.DHashMap.Internal.AssocList.erase {α : Type u} {β : αType v} [BEq α] (a : α) :
AssocList α βAssocList α β

Internal implementation detail of the hash map

Equations
@[specialize #[]]
def Std.DHashMap.Internal.AssocList.modify {α : Type u} {β : αType v} [BEq α] [LawfulBEq α] (a : α) (f : β aβ a) :
AssocList α βAssocList α β

Internal implementation detail of the hash map

Equations
@[specialize #[]]
def Std.DHashMap.Internal.AssocList.alter {α : Type u} {β : αType v} [BEq α] [LawfulBEq α] (a : α) (f : Option (β a)Option (β a)) :
AssocList α βAssocList α β

Internal implementation detail of the hash map

Equations
  • One or more equations did not get rendered due to their size.
@[specialize #[]]
def Std.DHashMap.Internal.AssocList.Const.modify {α : Type u} [BEq α] {β : Type v} (a : α) (f : ββ) :
(AssocList α fun (x : α) => β)AssocList α fun (x : α) => β

Internal implementation detail of the hash map

Equations
@[specialize #[]]
def Std.DHashMap.Internal.AssocList.Const.alter {α : Type u} [BEq α] {β : Type v} (a : α) (f : Option βOption β) :
(AssocList α fun (x : α) => β)AssocList α fun (x : α) => β

Internal implementation detail of the hash map

Equations
  • One or more equations did not get rendered due to their size.
@[inline]
def Std.DHashMap.Internal.AssocList.filterMap {α : Type u} {β : αType v} {γ : αType w} (f : (a : α) → β aOption (γ a)) :
AssocList α βAssocList α γ

Internal implementation detail of the hash map

Equations
@[specialize #[]]
def Std.DHashMap.Internal.AssocList.filterMap.go {α : Type u} {β : αType v} {γ : αType w} (f : (a : α) → β aOption (γ a)) (acc : AssocList α γ) :
AssocList α βAssocList α γ
Equations
@[inline]
def Std.DHashMap.Internal.AssocList.map {α : Type u} {β : αType v} {γ : αType w} (f : (a : α) → β aγ a) :
AssocList α βAssocList α γ

Internal implementation detail of the hash map

Equations
@[inline]
def Std.DHashMap.Internal.AssocList.filter {α : Type u} {β : αType v} (f : (a : α) → β aBool) :
AssocList α βAssocList α β

Internal implementation detail of the hash map

Equations
@[specialize #[]]
def Std.DHashMap.Internal.AssocList.filter.go {α : Type u} {β : αType v} (f : (a : α) → β aBool) (acc : AssocList α β) :
AssocList α βAssocList α β
Equations