static-hash-0.0.1: Immutable hash

Safe HaskellSafe-Infered

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) 

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

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 vSource

Creating StaticHash from a list and its size.

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

Looking up StaticHash.