A set of unique values. Unlike in the elm Set, the elements can be any type that can be converted to an elm 'comparable'.
This is helpful if you have values that are really just a comparable underneath, but you want to keep them separate using the type system. For instance
type Kilos = Kilos Float type Pounds = Pounds Float
Create a TSet with the empty function, which takes two converter functions as arguments. It can be convenient to create a canonical empty TSet for a certain type:
emptyKiloSet = TSet.empty ((Kilos n) -> n) Kilos
Then to do the equivalent of fromList:
TSet.insertList emptyKiloSet mykilolist
Insert, remove, and query operations all take O(log n) time.
Remove a value from a set. If the value is not found, no changes are made.
Get the union of two sets. Keep all values.
Get the intersection of two sets. Keeps values that appear in both sets.
Get the difference between the first set and the second. Keeps values that do not appear in the second set.
Insert a list of values into a set.
Map a function onto a set, inserting into a second set.
Fold over the values in a set, in order from lowest to highest.
Fold over the values in a set, in order from highest to lowest.
Create a new set consisting only of elements which satisfy a predicate.
Represents a set of unique values. So
(Set Int)is a set of integers and(Set String)is a set of strings.