Skip to main content

Daml module

DA.Set

Note: This is only supported in Daml-LF 1.11 or later.

Data Types

data Set k

The type of a set. This is a wrapper over the Map type. Constructors:
  • Set
Map k ()
Instances:

Functions

empty

empty : Set k The empty set.

size

size : Set k -> Int The number of elements in the set.

toList

toList : Set k -> [k] Convert the set to a list of elements.

fromList

fromList : Ord k => [k] -> Set k Create a set from a list of elements.

toMap

toMap : Set k -> Map k () Convert a Set into a Map.

fromMap

fromMap : Map k () -> Set k Create a Set from a Map.

member

member : Ord k => k -> Set k -> Bool Is the element in the set?

notMember

notMember : Ord k => k -> Set k -> Bool Is the element not in the set? notMember k s is equivalent to not (member k s).

null

null : Set k -> Bool Is this the empty set?

insert

insert : Ord k => k -> Set k -> Set k Insert an element in a set. If the set already contains the element, this returns the set unchanged.

filter

filter : Ord k => (k -> Bool) -> Set k -> Set k Filter all elements that satisfy the predicate.

delete

delete : Ord k => k -> Set k -> Set k Delete an element from a set.

singleton

singleton : Ord k => k -> Set k Create a singleton set.

union

union : Ord k => Set k -> Set k -> Set k The union of two sets.

intersection

intersection : Ord k => Set k -> Set k -> Set k The intersection of two sets.

difference

difference : Ord k => Set k -> Set k -> Set k

isSubsetOf

isSubsetOf : Ord k => Set k -> Set k -> Bool isSubsetOf a b returns true if a is a subset of b, that is, if every element of a is in b.

isProperSubsetOf

isProperSubsetOf : Ord k => Set k -> Set k -> Bool isProperSubsetOf a b returns true if a is a proper subset of b. That is, if a is a subset of b but not equal to b.

Orphan Typeclass Instances

History

Updated3.5.1

Module declarations or documentation updated.

Added3.4.9