Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions doc/README/Data/Tree/AVL.agda
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ open import Relation.Binary.PropositionalEquality
open Data.Tree.AVL <-strictTotalOrder renaming (Tree to Tree′)
Tree = Tree′ (MkValue (Vec String) (subst (Vec String)))

-- The first argument to `MkValue` should be a function from a key
-- (a `ℕ` in this case) to a value type (a `String` vector type).
-- Since `(Vec String)` is missing `Vec`'s second parameter, a `ℕ`,
-- it's equivalent to `λ n → Vec String n`.

-- The second argument to `MkValue` is a function that can accept
-- a proof that two keys are equal, and then substitute a unique key
-- for an equivalent key that is passed in. Applying `subst` to the
-- key-to-value-type function passed as `MkValue`'s first argument is
-- a normal way to create such a function.

-- Note that there is no need to define the type of keys separately:
-- passing a key-to-value-type function to `MkValue` and providing
-- the result of `MkValue` to `Data.Tree.AVL.Tree` is enough.

------------------------------------------------------------------------
-- Construction of trees

Expand Down Expand Up @@ -127,6 +142,10 @@ v₉ = refl

-- Variations of the AVL tree module are available:

-- • Finite maps in which types of values don't depend on keys.

import Data.Tree.AVL.Map

-- • Finite maps with indexed keys and values.

import Data.Tree.AVL.IndexedMap
Expand Down