Safe Haskell | None |
---|---|
Language | Haskell2010 |
Constructs a minimal perfect hash.
Implementation was transliterated from Python on Steve Hanov's Blog and then refactored.
- createMinimalPerfectHash :: (Unbox b, Defaultable b, ToHashableChunks a, Eq a, Hashable a) => [(a, b)] -> LookupTable b
Documentation
createMinimalPerfectHash Source #
:: (Unbox b, Defaultable b, ToHashableChunks a, Eq a, Hashable a) | |
=> [(a, b)] | key-value pairs |
-> LookupTable b |
Generates a minimal perfect hash for a set of key-value pairs.
The keys must be Foldable
s of ToNumeric
instances in order to be hashable.
The values may be of arbitrary type.
N.b. It is assumed that the input tuples list has no duplicate keys.