Module
Data.HashMap
- Package
- purescript-unordered-collections
- Repository
- fehrenbach/purescript-unordered-collections
#HashMap Source
data HashMap :: Type -> Type -> Type
Immutable hash maps from keys k
to values v
.
Note that this is an unordered collection.
The implementation is based on "Optimizing Hash-Array Mapped Tries for Fast and Lean Immutable JVM Collections" (Steindorfer and Vinju, OOPSLA 2015, https://doi.org/10.1145/2814270.2814312).
Instances
(Eq k, Eq v) => Eq (HashMap k v)
(Hashable k) => Monoid (HashMap k v)
(Hashable k) => Semigroup (HashMap k v)
Functor (HashMap k)
FunctorWithIndex k (HashMap k)
Foldable (HashMap k)
The
Foldable
instance is best used with a commutative function/Monoid
, since hash maps do not guarantee any particular order.FoldableWithIndex k (HashMap k)
The
FoldableWithIndex
instance is best used with a commutative function/Monoid
, since hash maps do not guarantee any particular order.(Show k, Show v) => Show (HashMap k v)
#fromFoldable Source
fromFoldable :: forall v k f. Foldable f => Hashable k => f (Tuple k v) -> HashMap k v
Turn a foldable functor of pairs into a hash map.
In the presence of duplicate keys, later (by foldl
) mappings
overwrite earlier mappings.
- Modules
- Data.
HashMap - Data.
Hashable
This is "the shallow" semigroup instance, where maps themselves are combined using
union
rather than elements being combined. For duplicate keys, values from the left map are preserved.