Cindiary/elm-id/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

type alias Set_ counter id =
Dict_ counter id ()

A type that can represent Id.Set and Id.CounterDict id ()

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 Id.Dict

fromIdList : List (Id a) value -> Set (Id a)

Create a set with the Ids from a Id.List

fromCounterList : CounterList (Id a) value -> Set (Id a)

Create a set with the Ids from a Id.CounterList

toList : Set_ counter (Id a) -> List (Id a)

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

isEmpty : Set_ counter (Id a) -> Bool

Determine if a set is empty.

size : Set_ counter (Id a) -> Int

Determine the number of Ids in the set.

member : Id a -> Set_ counter (Id a) -> Bool

Determine if a Id is in a set.

insert : Id a -> Set_ counter (Id a) -> Set_ counter (Id a)

Insert a Id into a set.

remove : Id a -> Set_ counter (Id a) -> Set_ counter (Id a)

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

accountForIds : Set_ counter (Id a) -> Counter (Id a) -> Counter (Id a)

Same as Id.Counter.accountForIds but can be used with a Set

filter : (Id a -> Bool) -> Set_ counter (Id a) -> Set_ counter (Id a)

Keep only the Ids that pass the given test.

fold : (Id a -> c -> c) -> c -> Set_ counter (Id a) -> c

Fold over the Ids in a set from lowest Id to highest Id.

(Id a -> Bool)
-> Set_ counter (Id a)
-> ( Set_ counter (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.

Set_ counter1 (Id a)
-> Dict_ counter2 (Id a) b
-> Set_ counter1 (Id a)

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

Set_ counter1 (Id a)
-> Dict_ counter2 (Id a) b
-> Set_ counter1 (Id a)

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

Dict_ counter1 (Id a) b
-> Set_ counter2 (Id a)
-> Set_ counter2 (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

leakyDecoder : Decoder (Set id)

A 'leaky' JSON Decoder for Set. Any invalid Ids will be skipped instead of failing the entire decoder.