#include "head.html"

Mengen

Auch das ein Modul, das man oft und gerne benutzt. Nicht in Haskell selbst standardisiert, aber in GHC.
data Set        -- abstract
                 -- instance of: Eq

 emptySet        :: Set a
 mkSet           :: Ord a => [a]  -> Set a
 setToList       :: Set a -> [a]
 unitSet         :: a -> Set a
 singletonSet    :: a -> Set a  -- deprecated, use unitSet.

 union           :: Ord a => Set a -> Set a -> Set a
 unionManySets   :: Ord a => [Set a] -> Set a
 minusSet        :: Ord a => Set a -> Set a -> Set a
 mapSet          :: Ord a => (b -> a) -> Set b -> Set a
 intersect       :: Ord a => Set a -> Set a -> Set a

 elementOf       :: Ord a => a -> Set a -> Bool
 isEmptySet      :: Set a -> Bool

 cardinality     :: Set a -> Int
Hier ist die offizielle Definition. Eine mögliche Implementierung ist
data Set a = Set (FiniteMap a ())
#include "foot.html"