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, Foldable f, ToNumeric a, Eq (f a), Hashable (f a)) => [(f a, b)] -> LookupTable b
Documentation
createMinimalPerfectHash :: (Unbox b, Defaultable b, Foldable f, ToNumeric a, Eq (f a), Hashable (f a)) => [(f a, b)] -> LookupTable b Source #
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.