fixplate-0.1.4: Uniplate-style generic traversals for optionally annotated fixed-point types.

Safe HaskellSafe-Infered

Data.Generics.Fixplate.Hash.Table

Contents

Description

Simple hash tables, implemented as Map hash (Map key value).

To be Haskell98 compatible (no multi-param type classes), when constructing a new hash table, we have to support the function computing (or just fetching, if it is cached) the hash value. This function is then stored in the data type.

Synopsis

Documentation

data HashTable hash k v Source

getHashValue :: HashTable hash k v -> k -> hashSource

unHashTable :: HashTable hash k v -> Map hash (Map k v)Source

Construction and deconstruction

empty :: (Ord hash, Ord k) => (k -> hash) -> HashTable hash k vSource

singleton :: (Ord hash, Ord k) => (k -> hash) -> k -> v -> HashTable hash k vSource

fromList :: (Ord hash, Ord k) => (k -> hash) -> [(k, v)] -> HashTable hash k vSource

toList :: Ord k => HashTable hash k v -> [(k, v)]Source

bag :: (Ord hash, Ord k) => (k -> hash) -> [k] -> HashTable hash k IntSource

Creates a multi-set from a list.

Membership

lookup :: (Ord hash, Ord k) => k -> HashTable hash k v -> Maybe vSource

member :: (Ord hash, Ord k) => k -> HashTable hash k v -> BoolSource

Insert

insert :: (Ord hash, Ord k) => k -> v -> HashTable hash k v -> HashTable hash k vSource

insertWith :: (Ord hash, Ord k) => (a -> v) -> (a -> v -> v) -> k -> a -> HashTable hash k v -> HashTable hash k vSource