Safe Haskell | None |
---|---|
Language | Haskell2010 |
Constructs a minimal perfect hash from a map of key-value pairs.
Implementation was adapted from Steve Hanov's Blog.
A refactoring of that Python implementation may be found here. This Haskell implementation is transliterated from that refactoring.
- createMinimalPerfectHash :: (Unbox b, Defaultable b, ToHashableChunks a, Eq a, Hashable a) => HashMap a b -> LookupTable b
- class Defaultable a
Documentation
createMinimalPerfectHash Source #
:: (Unbox b, Defaultable b, ToHashableChunks a, Eq a, Hashable a) | |
=> HashMap a b | key-value pairs |
-> LookupTable b | output for use by |
Generates a minimal perfect hash for a set of key-value pairs.
The keys must be instances of ToHashableChunks
.
The values may be of arbitrary type.
A HashMap
is required as input to guarantee that there are no duplicate keys.