Gizra/elm-all-set/1.0.1

EverySet

A set of unique values. The values can be any type, as the implementation is based on AssocList

Sets

type EverySet a

Represents a set of unique values. So (Set Int) is a set of integers and (Set String) is a set of strings.

Build

Create an empty set.

Create a set with one value.

insert : a -> EverySet a -> EverySet a

Insert a value into a set.

remove : a -> EverySet a -> EverySet a

Remove a value from a set. If the value is not found, no changes are made.

Query

isEmpty : EverySet a -> Bool

Determine if a set is empty.

member : a -> EverySet a -> Bool

Determine if a value is in a set.

size : EverySet a -> Int

Determine the number of elements in a set.

Combine

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.

Lists

toList : EverySet a -> List a

Convert a set into a list, sorted from lowest to highest.

fromList : List a -> EverySet a

Convert a list into a set, removing any duplicates.

Transform

map : (a -> a2) -> EverySet a -> EverySet a2

Map a function onto a set, creating a new set with no duplicates.

foldl : (a -> b -> b) -> b -> EverySet a -> b

Fold over the values in a set, in order from lowest to highest.

foldr : (a -> b -> b) -> b -> EverySet a -> b

Fold over the values in a set, in order from highest to lowest.

filter : (a -> Bool) -> EverySet a -> EverySet a

Create a new set consisting only of elements which satisfy a predicate.

partition : (a -> Bool) -> EverySet a -> ( EverySet a, EverySet a )

Create two new sets; the first consisting of elements which satisfy a predicate, the second consisting of elements which do not.