stm-containers-0.1.3: Containers for STM

Safe HaskellNone

STMContainers.Map

Synopsis

Documentation

data Map k v Source

A hash table, based on an STM-specialized hash array mapped trie.

type Key a = (Eq a, Hashable a)Source

A standard constraint for keys.

new :: STM (Map k v)Source

Construct a new map.

insert :: Key k => v -> k -> Map k v -> STM ()Source

Insert a value at a key.

delete :: Key k => k -> Map k v -> STM ()Source

Delete an item by a key.

lookup :: Key k => k -> Map k v -> STM (Maybe v)Source

Look up an item.

focus :: Key k => StrategyM STM v r -> k -> Map k v -> STM rSource

Focus on an item by a key with a strategy.

This function allows to perform composite operations in a single access to a map item. E.g., you can look up an item and delete it at the same time, or update it and return the new value.

foldM :: (a -> (k, v) -> STM a) -> a -> Map k v -> STM aSource

Fold all the items of a map.

null :: Map k v -> STM BoolSource

Check, whether the map is empty.