Cindiary/elm-id/5.0.1

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 Set

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

fromDict : Dict_ counter (Id a) value -> Set (Id a)

Create a set with the Ids from a Dict

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