TernaryTrees-0.1.3.4: Efficient pure ternary tree Sets and Maps

Data.Set.TernarySet.Internal

Synopsis

Documentation

data TernarySet a Source

TernarySet a is ternary tree. It is commonly used for storing word lists like dictionaries.

Constructors

Node !a !(TernarySet a) !(TernarySet a) !(TernarySet a)

A Node has a less than, equal and greater than branch

Null !(TernarySet a)

Null nodes only have a greater nbranch, by definition

End

An empty tree

Instances

Eq a => Eq (TernarySet a) 
Show a => Show (TernarySet a) 
Binary a => Binary (TernarySet a)

This binary uses the fact that the number of Ends can be represented in binary numbers to save a lot of space.

treeSize :: TernarySet a -> IntSource

Returns the number of non-Null Elems.