static-hash-0.0.2: Immutable hash

Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.StaticHash

Description

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

Synopsis

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

# Documentation

data StaticHash k v Source #

Data type for immutable hashes.

#### Instances

Instances details

(Show k, Show v) => Show (StaticHash k v) Source # |
Instance details Defined in Data.StaticHash Methods showsPrec :: Int -> StaticHash k v -> ShowS Source # show :: StaticHash k v -> String Source # showList :: [StaticHash k v] -> ShowS 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`.