Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- data TypeSet a
- type family Member (t :: k) (bst :: TypeSet k) :: Bool where ...
- type family Insert (t :: k) (bst :: TypeSet k) :: TypeSet k where ...
- type family Remove (t :: k) (bst :: TypeSet k) :: TypeSet k where ...
- type family Merge (small :: TypeSet k) (big :: TypeSet k) :: TypeSet k where ...
- type family Locate (t :: k) (bst :: TypeSet k) :: [Side] where ...
- type family Follow (ss :: [Side]) (bst :: TypeSet k) :: k where ...
- data Side
Core type
A binary search tree. When -XDataKinds
is turned on, this becomes the
backbone of the type-level set.
>>>
type MySet = Insert Bool (Insert String (Insert (Maybe Int) 'Empty))
Set operations
type family Member (t :: k) (bst :: TypeSet k) :: Bool where ... Source #
O(log n). Determine membership in the 'TypeSet.'
type family Insert (t :: k) (bst :: TypeSet k) :: TypeSet k where ... Source #
O(log n). Insert an element into the TypeSet
.
type family Remove (t :: k) (bst :: TypeSet k) :: TypeSet k where ... Source #
O(log n). Remove an element from the TypeSet
.
type family Merge (small :: TypeSet k) (big :: TypeSet k) :: TypeSet k where ... Source #
O(m log n) for Merge m n
; put your smaller set on the left side. Merge
two TypeSet
s together.
Tree operations
type family Locate (t :: k) (bst :: TypeSet k) :: [Side] where ... Source #
type family Follow (ss :: [Side]) (bst :: TypeSet k) :: k where ... Source #
O(log n). Follow the result of a Locate
to get a particular element in
the tree.
Either left or right down a path.