data Set a = MkSet (Map a Unit)
importPour l'utiliser :
import Data.SetSet — ordered, immutable finite sets
Synopsis
data Set a = MkSet (Map a Unit)empty : Set asingleton : a -> Set aisEmpty : Set a -> Boolsize : Set a -> Natmember : Ord a => a -> Set a -> Boolinsert : Ord a => a -> Set a -> Set adelete : Ord a => a -> Set a -> Set atoList : Set a -> List afromList : Ord a => List a -> Set aunion : Ord a => Set a -> Set a -> Set aintersection : Ord a => Set a -> Set a -> Set adifference : Ord a => Set a -> Set a -> Set aisSubsetOf : Ord a => Set a -> Set a -> Boolfilter : Ord a => (a -> Bool) -> Set a -> Set amap : Ord b => (a -> b) -> Set a -> Set bfoldr : (a -> b -> b) -> b -> Set a -> bfoldl : (b -> a -> b) -> b -> Set a -> b
empty : Set a
The empty set.
singleton : a -> Set a
A set with a single element.
isEmpty : Set a -> Bool
True if the set has no elements.
size : Set a -> Nat
The number of elements (O(1)).
member : Ord a => a -> Set a -> Bool
True if the element is in the set.
insert : Ord a => a -> Set a -> Set a
Insert an element (a no-op if already present).
delete : Ord a => a -> Set a -> Set a
Remove an element (a no-op if absent).
toList : Set a -> List a
The elements as a list, in ascending order.
fromList : Ord a => List a -> Set a
Build a set from a list (duplicates collapse).
union : Ord a => Set a -> Set a -> Set a
Union (all elements of either set).
intersection : Ord a => Set a -> Set a -> Set a
Intersection (elements in both sets).
difference : Ord a => Set a -> Set a -> Set a
Difference (elements of the first set not in the second).
isSubsetOf : Ord a => Set a -> Set a -> Bool
True if every element of the first set is in the second.
filter : Ord a => (a -> Bool) -> Set a -> Set a
Keep only the elements satisfying the predicate.
map : Ord b => (a -> b) -> Set a -> Set b
foldr : (a -> b -> b) -> b -> Set a -> b
Fold over the elements in ascending order.
foldl : (b -> a -> b) -> b -> Set a -> b
Left fold over the elements in ascending order.