A builder for attributes that are applied to declarations of a common type and
group them by the given attribute argument (an arbitrary Name
, currently).
Also creates a second "builtin" attribute used for bootstrapping, which saves
the applied declarations in an IO.Ref
instead of an environment extension.
Used to register elaborators, macros, tactics, and delaborators.
@[inline]
Equations
- builtinName : Lean.Name
- name : Lean.Name
- descr : String
- valueTypeName : Lean.Name
- evalKey : Bool → Lean.Syntax → Lean.AttrM Lean.KeyedDeclsAttribute.Key
- onAdded : Bool → Lean.Name → Lean.AttrM Unit
KeyedDeclsAttribute
definition.
Important: mkConst valueTypeName
and γ
must be definitionally equal.
instance
Lean.KeyedDeclsAttribute.instInhabitedDef:
{a : Type} → Inhabited (Lean.KeyedDeclsAttribute.Def a)
Equations
- One or more equations did not get rendered due to their size.
- declName : Lean.Name
Equations
- Lean.KeyedDeclsAttribute.instInhabitedOLeanEntry = { default := { key := default, declName := default } }
structure
Lean.KeyedDeclsAttribute.AttributeEntry
(γ : Type)
extends
Lean.KeyedDeclsAttribute.OLeanEntry
:
Type
- value : γ
@[inline]
- newEntries : List Lean.KeyedDeclsAttribute.OLeanEntry
- table : Lean.KeyedDeclsAttribute.Table γ
- declNames : Std.PHashSet Lean.Name
- erased : Std.PHashSet Lean.Name
instance
Lean.KeyedDeclsAttribute.instInhabitedExtensionState:
{a : Type} → Inhabited (Lean.KeyedDeclsAttribute.ExtensionState a)
Equations
- Lean.KeyedDeclsAttribute.instInhabitedExtensionState = { default := { newEntries := default, table := default, declNames := default, erased := default } }
@[inline]
- defn : Lean.KeyedDeclsAttribute.Def γ
- tableRef : IO.Ref (Lean.KeyedDeclsAttribute.Table γ)
def
Lean.KeyedDeclsAttribute.ExtensionState.insert
{γ : Type}
(s : Lean.KeyedDeclsAttribute.ExtensionState γ)
(v : Lean.KeyedDeclsAttribute.AttributeEntry γ)
:
Equations
- One or more equations did not get rendered due to their size.
def
Lean.KeyedDeclsAttribute.addBuiltin
{γ : Type}
(attr : Lean.KeyedDeclsAttribute γ)
(key : Lean.KeyedDeclsAttribute.Key)
(declName : Lean.Name)
(value : γ)
:
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
def
Lean.KeyedDeclsAttribute.ExtensionState.erase
{γ : Type}
(s : Lean.KeyedDeclsAttribute.ExtensionState γ)
(attrName : Lean.Name)
(declName : Lean.Name)
:
Equations
- One or more equations did not get rendered due to their size.
unsafe def
Lean.KeyedDeclsAttribute.init
{γ : Type}
(df : Lean.KeyedDeclsAttribute.Def γ)
(attrDeclName : Lean.Name)
:
Equations
- One or more equations did not get rendered due to their size.
def
Lean.KeyedDeclsAttribute.getEntries
{γ : Type}
(attr : Lean.KeyedDeclsAttribute γ)
(env : Lean.Environment)
(key : Lean.Name)
:
Retrieve entries tagged with [attr key]
or [builtinAttr key]
.
Equations
- One or more equations did not get rendered due to their size.
def
Lean.KeyedDeclsAttribute.getValues
{γ : Type}
(attr : Lean.KeyedDeclsAttribute γ)
(env : Lean.Environment)
(key : Lean.Name)
:
List γ
Retrieve values tagged with [attr key]
or [builtinAttr key]
.
Equations
- Lean.KeyedDeclsAttribute.getValues attr env key = List.map Lean.KeyedDeclsAttribute.AttributeEntry.value (Lean.KeyedDeclsAttribute.getEntries attr env key)