Module Data.Set

An efficient implementation of set based on finite maps.

Summary of exported operations:

empty :: Map a ()  Deterministic 
Returns an empty set.
fromList :: Ord a => [a] -> Map a ()  Deterministic 
Transforms a list into a set of its elements.
null :: Map a () -> Bool  Deterministic 
Test for an empty set.
insert :: Ord a => a -> Map a () -> Map a ()  Deterministic 
Inserts an element into a set if it is not already there.
delete :: Ord a => a -> Map a () -> Map a ()  Deterministic 
Deletes an element from a set.
deleteAll :: Ord a => [a] -> Map a () -> Map a ()  Deterministic 
Deletes a list of elements from a set.
size :: Map a () -> Int  Deterministic 
Computes the size of two sets.
member :: Ord a => a -> Map a () -> Bool  Deterministic 
Returns True if an element is contained in a set.
difference :: Ord a => Map a () -> Map a () -> Map a ()  Deterministic 
Computes the difference of two sets.
toList :: Map a () -> [a]  Deterministic 
Transforms a set into an ordered list of its elements.
union :: Ord a => Map a () -> Map a () -> Map a ()  Deterministic 
Computes the union of two sets.

Exported datatypes:


Set

The type of sets of elements.

Type synonym: Set a = Map a ()


Exported operations:

empty :: Map a ()  Deterministic 

Returns an empty set.

Further infos:
  • solution complete, i.e., able to compute all solutions

fromList :: Ord a => [a] -> Map a ()  Deterministic 

Transforms a list into a set of its elements.

null :: Map a () -> Bool  Deterministic 

Test for an empty set.

insert :: Ord a => a -> Map a () -> Map a ()  Deterministic 

Inserts an element into a set if it is not already there.

delete :: Ord a => a -> Map a () -> Map a ()  Deterministic 

Deletes an element from a set.

deleteAll :: Ord a => [a] -> Map a () -> Map a ()  Deterministic 

Deletes a list of elements from a set.

size :: Map a () -> Int  Deterministic 

Computes the size of two sets.

Further infos:
  • solution complete, i.e., able to compute all solutions

member :: Ord a => a -> Map a () -> Bool  Deterministic 

Returns True if an element is contained in a set.

Example call:
(member e s)
Parameters:
  • e : an element to be checked for containment
  • s : a set
Returns:
True if e is contained in s

difference :: Ord a => Map a () -> Map a () -> Map a ()  Deterministic 

Computes the difference of two sets.

toList :: Map a () -> [a]  Deterministic 

Transforms a set into an ordered list of its elements.

union :: Ord a => Map a () -> Map a () -> Map a ()  Deterministic 

Computes the union of two sets.