static-hash-0.0.1: Immutable hash

Safe HaskellSafe
LanguageHaskell98

Data.StaticHash

Description

Pure immutable hash whose lookup is O(1) on the average, but O(N) in the worst case.

Synopsis

Documentation

data StaticHash k v Source

Data type for immutable hashes.

Instances

(Show k, Show v) => Show (StaticHash k v) Source 

fromList :: (Eq k, Ord k, Hashable k) => [(k, v)] -> StaticHash k v Source

Creating StaticHash from a list. A prime around the length of the list x 2 is chosen for the size of array. This may prevent collisions.

fromList' :: (Eq k, Ord k, Hashable k) => Int -> [(k, v)] -> StaticHash k v Source

Creating StaticHash from a list and its size.

lookup :: (Eq k, Ord k, Hashable k) => k -> StaticHash k v -> Maybe v Source

Looking up StaticHash.