Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
(Show k, Show v) => Show (StaticHash k v) Source # | |
Defined in Data.StaticHash showsPrec :: Int -> StaticHash k v -> ShowS # show :: StaticHash k v -> String # showList :: [StaticHash k v] -> ShowS # |
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
.