Module
Data.HashSet
- Package
- purescript-unordered-collections
- Repository
- fehrenbach/purescript-unordered-collections
#map Source
map :: forall a b. Hashable b => (a -> b) -> HashSet a -> HashSet b
Construct a new set by applying a function to each element of an input set.
If distinct inputs map to the same output, this changes the
cardinality of the set, therefore hash set is not a Functor
.
Also, the order in which elements appear in the new set is
entirely dependent on the hash function for type b
.
#intersection Source
intersection :: forall a. Hashable a => HashSet a -> HashSet a -> HashSet a
Intersect two sets.
#difference Source
difference :: forall a. Hashable a => HashSet a -> HashSet a -> HashSet a
Difference of two sets.
Also known as set minus or relative complement. Returns a set of all elements of the left set that are not in the right set.
#fromFoldable Source
fromFoldable :: forall f a. Foldable f => Hashable a => f a -> HashSet a
Create a set from a foldable structure.
#toUnfoldable Source
toUnfoldable :: forall f a. Unfoldable f => HashSet a -> f a
Turn a set into an unfoldable functor.
You probably want to use toArray
instead, especially if you
want to get an array out.
- Modules
- Data.
HashMap - Data.
HashSet - Data.
Hashable
The
Foldable
instance is best used with a commutative function/Monoid
, since hash sets do not guarantee any particular order.