Cindiary/elm-id/4.0.0

NOTE: the latest version is 7.1.0

ID.Set

type alias Set id =
Dict id ()

A set type for IDs, is equal to a ID.Dict with empty tuples as values

empty : Set (ID a)

Create a empty Dict

singleton : ID a -> Set (ID a)

Create a set with a single ID

fromList : List (ID a) -> Set (ID a)

Create a set from a list of IDs

toList : Set (ID a) -> List (ID a)

Get all of the IDs in a set, sorted from lowest to highest.

isEmpty : Set (ID a) -> Bool

Determine if a set is empty.

size : Set (ID a) -> Int

Determine the number of IDs in the set.

member : ID a -> Set (ID a) -> Bool

Determine if a ID is in a set.

insert : ID a -> Set (ID a) -> Set (ID a)

Insert a ID into a set.

remove : ID a -> Set (ID a) -> Set (ID a)

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

filter : (ID a -> Bool) -> Set (ID a) -> Set (ID a)

Keep only the IDs that pass the given test.

fold : (ID a -> c -> c) -> c -> Set (ID a) -> c

Fold over the IDs in a set from lowest ID to highest ID.

partition : (ID a -> Bool) -> Set (ID a) -> ( Set (ID a), Set (ID a) )

Partition a set according to some test. The first set contains all IDs which passed the test, and the second contains the IDs that did not.

diff : Set (ID a) -> Set (ID a) -> Set (ID a)

Get the difference between the first set and the second. Keeps IDs that do not appear in the second set.

intersect : Set (ID a) -> Set (ID a) -> Set (ID a)

Get the intersection of two sets. Keeps IDs that appear in both sets.

union : Set (ID a) -> Set (ID a) -> Set (ID a)

Get the union of two sets. Keep all IDs.

Json

encode : Set id -> Value

Encode Set to a JSON value

decoder : Decoder (Set id)

JSON Decoder for Set