splaytree-0.1.5: Provides an annotated splay tree

Safe HaskellNone

Data.SplayTree.Set

Synopsis

Documentation

data Set a Source

Instances

Foldable Set 
Eq a => Eq (Set a) 
Ord a => Ord (Set a) 
Show a => Show (Set a) 
Ord a => Monoid (Set a) 

empty :: Ord a => Set aSource

Construct an empty set

null :: Ord a => Set a -> BoolSource

True if this set is empty, False otherwise.

size :: Ord a => Set a -> IntSource

Return the number of elements in this set.

member :: Ord a => a -> Set a -> BoolSource

Return True if the given value is present in this set, False otherwise.

memberSplay :: Ord a => a -> Set a -> (Bool, Set a)Source

Check if a is a member, and return a set splayed to a. The return set is splayed to an element near a if a isn't in the set.

insert :: Ord a => a -> Set a -> Set aSource

Add the specified value to this set.

delete :: Ord a => a -> Set a -> Set aSource

Remove the specified value from this set if present.

union :: Ord a => Set a -> Set a -> Set aSource

Construct a set containing all elements from both sets.

The smaller set should be presented as the second argument.

difference :: Ord a => Set a -> Set a -> Set aSource

Difference of two sets. Contains elements of the first set that are not present in the second.

intersection :: Ord a => Set a -> Set a -> Set aSource

Intersection of two sets. Contains all elements which are in both sets.

map :: (Ord a, Ord b) => (a -> b) -> Set a -> Set bSource

Transform this set by applying a function to every value.

fromList :: Ord a => [a] -> Set aSource

Construct a Set from a list of elements.

The Set is created by calling fromListBalance.