Equations
- Data.instBEqKey = { beq := Data.instBEqKey.beq }
Equations
- Data.instHashableKey = { hash := Data.instHashableKey.hash }
A type-safe heterogeneous map. Values of different types can coexist,
each accessible only through its corresponding typed Key.
$$\text{Vault} = \text{HashMap}(\mathbb{N}, \text{Any})$$
- store : Std.HashMap Nat Data.Any
Instances For
Allocate a fresh typed key. Each call returns a distinct key. $$\text{new} : \text{IO}(\text{Key}\ \alpha)$$
Equations
- Data.Key.new = do let u ← Data.newUnique pure { id := u.id }
Instances For
The empty vault. $$\text{empty} : \text{Vault},\quad |\text{empty}| = 0$$
Equations
- Data.Vault.empty = { store := ∅ }
Instances For
Equations
- Data.Vault.instInhabited = { default := Data.Vault.empty }
Number of entries in the vault. $$\text{size}(v)$$
Equations
- v.size = (Data.Vault.store✝ v).size
Instances For
Delete a key and its associated value from the vault. $$\text{delete}(k, v) = v \setminus \{k\}$$
Equations
- Data.Vault.delete key v = { store := (Data.Vault.store✝ v).erase (Data.Key.id✝ key) }
Instances For
Adjust the value at a key, if present. $$\text{adjust}(f, k, v) = \begin{cases} v[k \mapsto f(v[k])] & k \in v \\ v & k \notin v \end{cases}$$
Equations
- Data.Vault.adjust f key v = match Data.Vault.lookup key v with | some val => Data.Vault.insert key (f val) v | none => v
Instances For
Union of two vaults. Right-biased: values from v2 take precedence.
$$\text{union}(v_1, v_2) = v_2 \cup v_1$$
Equations
- One or more equations did not get rendered due to their size.