haskus-utils-0.8.0.0: Haskus utility modules

Safe HaskellNone
LanguageHaskell2010

Haskus.Utils.STM.TMap

Description

STm hashmap

Synopsis

Documentation

type TMap a b = Map a b Source #

STM hashmap

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

A constraint for keys.

null :: TMap a b -> STM Bool Source #

Indicate if the map is empty

size :: TMap a b -> STM Int Source #

Get the number of elements in the map

lookup :: Key k => k -> TMap k a -> STM (Maybe a) Source #

Lookup an element in the map from its key

member :: Key k => k -> TMap k b -> STM Bool Source #

Check if a key is in the map

notMember :: Key k => k -> TMap k b -> STM Bool Source #

Check if a key is not in the map

empty :: STM (TMap a b) Source #

Create an empty map

singleton :: Key k => k -> v -> STM (TMap k v) Source #

Create a map containing a single element

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

Insert an element in the map

fromList :: Key k => [(k, v)] -> STM (TMap k v) Source #

Create a new TMap from a list

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

Delete an element from the map

elems :: TMap a b -> STM [b] Source #

Get values

keys :: TMap a b -> STM [a] Source #

Get keys

(!) :: Key k => TMap k v -> k -> STM v Source #

Unsafe lookup in the map