hans-3.0.2: Network Stack

Safe HaskellSafe
LanguageHaskell2010

Hans.HashTable

Synopsis

Documentation

data HashTable k a Source #

newHashTable :: (Eq k, Hashable k) => Int -> IO (HashTable k a) Source #

Create a new hash table with the given size.

lookup :: (Eq k, Hashable k) => k -> HashTable k a -> IO (Maybe a) Source #

delete :: (Eq k, Hashable k) => k -> HashTable k a -> IO () Source #

deletes :: (Eq k, Hashable k) => [k] -> HashTable k a -> IO () Source #

Delete a collection of keys from the table. This is good for multiple deletes, as deletes from the same bucket can be grouped together.

mapHashTable :: (Eq k, Hashable k) => (k -> a -> a) -> HashTable k a -> IO () Source #

mapHashTableM_ :: (Eq k, Hashable k) => (k -> a -> IO ()) -> HashTable k a -> IO () Source #

Monadic mapping over the values of a hash table.

filterHashTable :: (Eq k, Hashable k) => (k -> a -> Bool) -> HashTable k a -> IO () Source #

alter :: (Eq k, Hashable k) => (Maybe a -> (Maybe a, b)) -> k -> HashTable k a -> IO b Source #

Create, update, or delete an entry in the hash table, returning some additional value derived from the operation. NOTE: This operation is only useful when you need to perform any of these operations at the same time -- the specialized versions of the individual behaviors all perform slightly better.

keys :: HashTable k a -> IO [k] Source #

Gives back an (unsorted) list of all the keys present in the hash table.

hasKey :: (Eq k, Hashable k) => k -> HashTable k a -> IO Bool Source #