An efficient implementation of set based on finite maps.
empty
:: Map a ()
Returns an empty set. |
fromList
:: Ord a => [a] -> Map a ()
Transforms a list into a set of its elements. |
null
:: Map a () -> Bool
Test for an empty set. |
insert
:: Ord a => a -> Map a () -> Map a ()
Inserts an element into a set if it is not already there. |
delete
:: Ord a => a -> Map a () -> Map a ()
Deletes an element from a set. |
deleteAll
:: Ord a => [a] -> Map a () -> Map a ()
Deletes a list of elements from a set. |
size
:: Map a () -> Int
Computes the size of two sets. |
member
:: Ord a => a -> Map a () -> Bool
Returns True
if an element is contained in a set.
|
difference
:: Ord a => Map a () -> Map a () -> Map a ()
Computes the difference of two sets. |
toList
:: Map a () -> [a]
Transforms a set into an ordered list of its elements. |
union
:: Ord a => Map a () -> Map a () -> Map a ()
Computes the union of two sets. |
The type of sets of elements.
Type synonym: Set a = Map a ()
Returns an empty set.
|
Inserts an element into a set if it is not already there. |
Computes the size of two sets.
|
Returns
|
Computes the difference of two sets. |