Module DA.Next.Set

Set - The Set a type represents a set of elements of type a. Most operations require that a be an instance of the MapKey type class.

Data Types

data Set a

The type of a set.

instance MapKey a => Monoid (Set a)

instance MapKey a => Semigroup (Set a)

instance IsParties (Set Party)

instance Eq (Set a)

instance Ord (Set a)

instance (MapKey a, Show a) => Show (Set a)

Functions

empty

: Set a

The empty set.

size

: Set a -> Int

The number of elements in the set.

toList

: MapKey a => Set a -> [a]

Convert the set to a list of elements.

fromList

: MapKey a => [a] -> Set a

Create a set from a list of elements.

toTextMap

: Set Text -> TextMap ()

Convert a Set into a TextMap.

fromTextMap

: TextMap () -> Set Text

Create a Set from a TextMap.

member

: MapKey a => a -> Set a -> Bool

Is the element in the set?

null

: Set a -> Bool

Is this the empty set?

insert

: MapKey a => a -> Set a -> Set a

Insert an element in a set. If the set already contains an element equal to the given value, it is replaced with the new value.

filter

: MapKey a => (a -> Bool) -> Set a -> Set a

Filter all elements that satisfy the predicate.

delete

: MapKey a => a -> Set a -> Set a

Delete an element from a set.

singleton

: MapKey a => a -> Set a

Create a singleton set.

union

: MapKey a => Set a -> Set a -> Set a

The union of two sets, preferring the first set when equal elements are encountered.

intersection

: MapKey a => Set a -> Set a -> Set a

The intersection of two sets. Elements of the result come from the first set.

difference

: MapKey a => Set a -> Set a -> Set a

Difference of two sets.