FR
importPour l'utiliser : import Data.HashMap

Data.HashMap — a hash map keyed by Hashable + Eq

Synopsis
empty : HashMap k v

The empty hash map.

singleton : Hashable k => Eq k => k -> v -> HashMap k v

A hash map with a single entry.

fromList : Hashable k => Eq k => List (k, v) -> HashMap k v

Build from a list of pairs; later entries win on duplicate keys.

isEmpty : HashMap k v -> Bool

Is the map empty?

member : Hashable k => Eq k => k -> HashMap k v -> Bool

Is k present?

findWithDefault : Hashable k => Eq k => v -> k -> HashMap k v -> v

The value at k, or a default.

insert : Hashable k => Eq k => k -> v -> HashMap k v -> HashMap k v

Insert (or replace) the value at k. O(log n).

insertWith : Hashable k => Eq k => (v -> v -> v) -> k -> v -> HashMap k v -> HashMap k v

Insert with a combining function f new old when k already maps.

delete : Hashable k => Eq k => k -> HashMap k v -> HashMap k v

Remove k (a no-op if absent).

toList : HashMap k v -> List (k, v)

All entries, in an unspecified but DETERMINISTIC order (by hash, then by bucket insertion order — identical on both backends).

keys : HashMap k v -> List k

All keys (see toList for the order).

values : HashMap k v -> List v

All values.

size : HashMap k v -> Nat

The number of entries.

union : Hashable k => Eq k => HashMap k v -> HashMap k v -> HashMap k v

Left-biased union: entries of a win over b on shared keys.

mapValues : (v -> w) -> HashMap k v -> HashMap k w

Map a function over the values.