Copyright | (c) Nicolás Rodríguez 2021 |
---|---|
License | GPL-3 |
Maintainer | Nicolás Rodríguez |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe |
Language | Haskell2010 |
Implementation of the lookup algorithm over internalist BST trees. Since the lookup does not modify the tree, there is no need for proofs.
Documentation
class Lookupable (x :: Nat) (a :: Type) (t :: Tree) where Source #
This type class provides the functionality to lookup a node with key x
in a non empty BST
t
.
The lookup is defined at the value level and the type level.
It's necessary to know the type a
of the value stored in node with key x
so that the type of the value returned by lookup
may be specified.
Instances
(t ~ 'ForkTree l (Node n a1) r, a ~ LookupValueType x t t, o ~ CmpNat x n, Lookupable' x a ('ForkTree l (Node n a1) r) o) => Lookupable x a ('ForkTree l (Node n a1) r) Source # | |
class Lookupable' (x :: Nat) (a :: Type) (t :: Tree) (o :: Ordering) where Source #
This type class provides the functionality to lookup a node with key x
in a non empty BST
t
.
It's only used by the Lookupable
class and it has one extra parameter o
,
which is the type level comparison of x
with the key value of the root node.
The o
parameter guides the lookup.