A map from keys to values. A map cannot contain duplicate keys; each key can map to at most one value.
Instances27Bifoldable, Eq2, Ord2, Show2, NFData2, Hashable2, …
Bifoldable HashMapDefined in unordered-containers-0.2.21 · Data.HashMap.InternalEq2 HashMapDefined in unordered-containers-0.2.21 · Data.HashMap.InternalOrd2 HashMapDefined in unordered-containers-0.2.21 · Data.HashMap.InternalShow2 HashMapDefined in unordered-containers-0.2.21 · Data.HashMap.InternalNFData2 HashMapDefined in unordered-containers-0.2.21 · Data.HashMap.InternalHashable2 HashMapDefined in unordered-containers-0.2.21 · Data.HashMap.Internal(Lift k, Lift v) => Lift (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalFunctor (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalFoldable (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalTraversable (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalEq k => Eq1 (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalOrd k => Ord1 (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal(Hashable k, Read k) => Read1 (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalShow k => Show1 (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalNFData k => NFData1 (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalHashable k => Hashable1 (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalHashable k => IsList (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal(Eq k, Eq v) => Eq (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalNote that, in the presence of hash collisions, equal
HashMaps may behave differently, i.e. extensionality may be violated:Example2 expressions data D = A | B deriving (Eq, Show)instance Hashable D where hashWithSalt salt _d = salt
Example2 expressions x = fromList [(A,1), (B,2)]y = fromList [(B,2), (A,1)]
Example3 expressions x == yTruetoList x[(A,1),(B,2)]toList y[(B,2),(A,1)]
In general, the lack of extensionality can be observed with any function that depends on the key ordering, such as folds and traversals.
(Data k, Data v, Hashable k) => Data (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal(Ord k, Ord v) => Ord (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalThe ordering is total and consistent with the Eq instance. However, nothing else about the ordering is specified, and it may change from version to version of either this package or of
hashable.(Hashable k, Read k, Read e) => Read (HashMap k e)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal(Show k, Show v) => Show (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalHashable k => Semigroup (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.InternalHashable k => Monoid (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal(NFData k, NFData v) => NFData (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal(Hashable k, Hashable v) => Hashable (HashMap k v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internaltype Item (HashMap k v) = (k, v)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal