nikita-volkov/hashing-containers/1.0.0

NOTE: the latest version is 2.1.0

HashingContainers.HashSet

HashSet API.

type alias HashSet value =
{ equality : Equality value
, hashing : Hashing value
, trie : HashTrie value
}

Generic set of hashable elements.

Unlike Set from the "core" library it is not limited to any specific set of supported types for elements.

Construction

empty : Equality value -> Hashing value -> HashSet value

Construct an empty HashSet, providing instances of Equality and Hashing explicit typeclasses for value.

fromList : Equality value -> Hashing value -> List value -> HashSet value

Construct from a list of values, providing instances of Equality and Hashing explicit typeclasses for value.

fromArray : Equality value -> Hashing value -> Array value -> HashSet value

Construct from an array of values, providing instances of Equality and Hashing explicit typeclasses for value.

Transformation

insert : value -> HashSet value -> HashSet value

Insert a value into a set.

remove : value -> HashSet value -> HashSet value

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

Access

member : value -> HashSet value -> Bool

Determine if a value is in a set.

isEmpty : HashSet value -> Bool

Determine if a set is empty.

foldl : (value -> folding -> folding) -> folding -> HashSet value -> folding

Fold over the values in a set.

toList : HashSet value -> List value

Convert a set into a list.