Safe Haskell | None |
---|

A hashtable in STM.

- data HashTableSTM k v
- newSized :: Int -> IO (HashTableSTM k v)
- insert :: (Hashable k, Ord k) => HashTableSTM k v -> k -> v -> STM ()
- lookup :: (Hashable k, Ord k) => HashTableSTM k v -> k -> STM (Maybe v)
- delete :: (Hashable k, Ord k) => HashTableSTM k v -> k -> STM ()
- size :: HashTableSTM k v -> STM Int
- keys :: HashTableSTM k v -> STM [k]
- toList :: HashTableSTM k v -> STM [(k, v)]

# Documentation

data HashTableSTM k v Source

newSized :: Int -> IO (HashTableSTM k v)Source

Create a new HashTable with fixed size

insert :: (Hashable k, Ord k) => HashTableSTM k v -> k -> v -> STM ()Source

*O(log n)*. Insert a key/value pair into HashTable.

lookup :: (Hashable k, Ord k) => HashTableSTM k v -> k -> STM (Maybe v)Source

*O(log n)*. Lookup a key in HashTable.

delete :: (Hashable k, Ord k) => HashTableSTM k v -> k -> STM ()Source

*O(log n)*. Delete a key from HashTable.

size :: HashTableSTM k v -> STM IntSource

*O(1)*. Grab the size of the hash table.

keys :: HashTableSTM k v -> STM [k]Source

*O(n)*. Get a list of keys.

toList :: HashTableSTM k v -> STM [(k, v)]Source

*O(n)*. Get a list of key/value pairs.