- ofString: String → Lean.DataValue
- ofBool: Bool → Lean.DataValue
- ofName: Lake.Name → Lean.DataValue
- ofNat: Nat → Lean.DataValue
- ofInt: Int → Lean.DataValue
- ofSyntax: Lean.Syntax → Lean.DataValue
Value stored in a key-value map.
Instances For
Equations
- Lean.instInhabitedDataValue = { default := Lean.DataValue.ofString default }
Equations
- Lean.instBEqDataValue = { beq := Lean.beqDataValue✝ }
Equations
- Lean.instReprDataValue = { reprPrec := Lean.reprDataValue✝ }
@[export lean_mk_bool_data_value]
Equations
Instances For
@[export lean_data_value_bool]
Equations
- Lean.DataValue.getBoolEx x = match x with | Lean.DataValue.ofBool b => b | x => false
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[export lean_data_value_to_string]
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.instToStringDataValue = { toString := Lean.DataValue.str }
Equations
- Lean.instCoeStringDataValue = { coe := Lean.DataValue.ofString }
Equations
- Lean.instCoeBoolDataValue = { coe := Lean.DataValue.ofBool }
Equations
- Lean.instCoeNameDataValue = { coe := Lean.DataValue.ofName }
Equations
- Lean.instCoeNatDataValue = { coe := Lean.DataValue.ofNat }
Equations
- Lean.instCoeIntDataValue = { coe := Lean.DataValue.ofInt }
Equations
- Lean.instCoeSyntaxDataValue = { coe := Lean.DataValue.ofSyntax }
- entries : List (Lake.Name × Lean.DataValue)
A key-value map. We use it to represent user-selected options and Expr.mdata
.
Remark: we do not use RBMap
here because we need to manipulate KVMap
objects in
C++ and RBMap
is implemented in Lean. So, we use just a List
until we can
generate C++ code from Lean code.
Instances For
Equations
- Lean.instInhabitedKVMap = { default := { entries := default } }
Equations
- Lean.instReprKVMap = { reprPrec := Lean.reprKVMap✝ }
Equations
- Lean.KVMap.instToStringKVMap = { toString := fun m => toString m.entries }
Equations
- Lean.KVMap.isEmpty x = match x with | { entries := m } => List.isEmpty m
Instances For
Equations
- Lean.KVMap.size m = List.length m.entries
Instances For
Equations
- Lean.KVMap.findCore [] x = none
- Lean.KVMap.findCore ((k, v) :: m) x = if (k == x) = true then some v else Lean.KVMap.findCore m x
Instances For
Equations
- Lean.KVMap.find x x = match x, x with | { entries := m }, k => Lean.KVMap.findCore m k
Instances For
Equations
- Lean.KVMap.findD m k d₀ = Option.getD (Lean.KVMap.find m k) d₀
Instances For
Equations
- Lean.KVMap.insertCore [] x x = [(x, x)]
- Lean.KVMap.insertCore ((k, v) :: m) x x = if (k == x) = true then (k, x) :: m else (k, v) :: Lean.KVMap.insertCore m x x
Instances For
Equations
- Lean.KVMap.insert x x x = match x, x, x with | { entries := m }, k, v => { entries := Lean.KVMap.insertCore m k v }
Instances For
Equations
- Lean.KVMap.contains m n = Option.isSome (Lean.KVMap.find m n)
Instances For
Equations
- Lean.KVMap.getString m k defVal = match Lean.KVMap.find m k with | some (Lean.DataValue.ofString v) => v | x => defVal
Instances For
Equations
- Lean.KVMap.getNat m k defVal = match Lean.KVMap.find m k with | some (Lean.DataValue.ofNat v) => v | x => defVal
Instances For
Equations
- Lean.KVMap.getInt m k defVal = match Lean.KVMap.find m k with | some (Lean.DataValue.ofInt v) => v | x => defVal
Instances For
Equations
- Lean.KVMap.getBool m k defVal = match Lean.KVMap.find m k with | some (Lean.DataValue.ofBool v) => v | x => defVal
Instances For
def
Lean.KVMap.getName
(m : Lean.KVMap)
(k : Lake.Name)
(defVal : optParam Lake.Name Lean.Name.anonymous)
:
Equations
- Lean.KVMap.getName m k defVal = match Lean.KVMap.find m k with | some (Lean.DataValue.ofName v) => v | x => defVal
Instances For
def
Lean.KVMap.getSyntax
(m : Lean.KVMap)
(k : Lake.Name)
(defVal : optParam Lean.Syntax Lean.Syntax.missing)
:
Equations
- Lean.KVMap.getSyntax m k defVal = match Lean.KVMap.find m k with | some (Lean.DataValue.ofSyntax v) => v | x => defVal
Instances For
Equations
- Lean.KVMap.setString m k v = Lean.KVMap.insert m k (Lean.DataValue.ofString v)
Instances For
Equations
- Lean.KVMap.setNat m k v = Lean.KVMap.insert m k (Lean.DataValue.ofNat v)
Instances For
Equations
- Lean.KVMap.setInt m k v = Lean.KVMap.insert m k (Lean.DataValue.ofInt v)
Instances For
Equations
- Lean.KVMap.setBool m k v = Lean.KVMap.insert m k (Lean.DataValue.ofBool v)
Instances For
Equations
- Lean.KVMap.setName m k v = Lean.KVMap.insert m k (Lean.DataValue.ofName v)
Instances For
Equations
- Lean.KVMap.setSyntax m k v = Lean.KVMap.insert m k (Lean.DataValue.ofSyntax v)
Instances For
@[inline]
def
Lean.KVMap.forIn
{δ : Type w}
{m : Type w → Type w'}
[Monad m]
(kv : Lean.KVMap)
(init : δ)
(f : Lake.Name × Lean.DataValue → δ → m (ForInStep δ))
:
m δ
Equations
- Lean.KVMap.forIn kv init f = List.forIn kv.entries init f
Instances For
Equations
- Lean.KVMap.subsetAux [] x = true
- Lean.KVMap.subsetAux ((k, v₁) :: m₁) x = match Lean.KVMap.find x k with | some v₂ => v₁ == v₂ && Lean.KVMap.subsetAux m₁ x | none => false
Instances For
Equations
- Lean.KVMap.subset x x = match x, x with | { entries := m₁ }, m₂ => Lean.KVMap.subsetAux m₁ m₂
Instances For
Equations
- Lean.KVMap.eqv m₁ m₂ = (Lean.KVMap.subset m₁ m₂ && Lean.KVMap.subset m₂ m₁)
Instances For
Equations
- Lean.KVMap.instBEqKVMap = { beq := Lean.KVMap.eqv }
- toDataValue : α → Lean.DataValue
- ofDataValue? : Lean.DataValue → Option α
Instances
@[inline]
Equations
- Lean.KVMap.get? m k = Option.bind (Lean.KVMap.find m k) Lean.KVMap.Value.ofDataValue?
Instances For
@[inline]
Equations
- Lean.KVMap.get m k defVal = Option.getD (Lean.KVMap.get? m k) defVal
Instances For
@[inline]
Equations
- Lean.KVMap.set m k v = Lean.KVMap.insert m k (Lean.KVMap.Value.toDataValue v)
Instances For
Equations
- Lean.KVMap.instValueDataValue = { toDataValue := id, ofDataValue? := some }
Equations
- Lean.KVMap.instValueBool = { toDataValue := Lean.DataValue.ofBool, ofDataValue? := fun x => match x with | Lean.DataValue.ofBool b => some b | x => none }
Equations
- Lean.KVMap.instValueNat = { toDataValue := Lean.DataValue.ofNat, ofDataValue? := fun x => match x with | Lean.DataValue.ofNat n => some n | x => none }
Equations
- Lean.KVMap.instValueInt = { toDataValue := Lean.DataValue.ofInt, ofDataValue? := fun x => match x with | Lean.DataValue.ofInt i => some i | x => none }
Equations
- Lean.KVMap.instValueName = { toDataValue := Lean.DataValue.ofName, ofDataValue? := fun x => match x with | Lean.DataValue.ofName n => some n | x => none }
Equations
- Lean.KVMap.instValueString = { toDataValue := Lean.DataValue.ofString, ofDataValue? := fun x => match x with | Lean.DataValue.ofString n => some n | x => none }
Equations
- Lean.KVMap.instValueSyntax = { toDataValue := Lean.DataValue.ofSyntax, ofDataValue? := fun x => match x with | Lean.DataValue.ofSyntax n => some n | x => none }