An implementation of extensible hash tables, as described in
Per-Ake Larson, Dynamic Hash Tables, CACM 31(4), April 1988,
pp. 446--457. The implementation is also derived from the one
in GHC's runtime system (ghc/rts/Hash.{c,h}).

This implementation of hash tables uses the low-order n bits of the hash
value for a key, where n varies as the hash table grows. A good hash
function therefore will give an even distribution regardless of n.

If your keyspace is integrals such that the low-order bits between
keys are highly variable, then you could get away with using id
as the hash function.

A sample hash function for Int, implemented as simply (x mod P)
where P is a suitable prime (currently 1500007). Should give
reasonable results for most distributions of Int values, except
when the keys are all multiples of the prime!

This function is useful for determining whether your hash function
is working well for your data set. It returns the longest chain
of key/value pairs in the hash table for which all the keys hash to
the same bucket. If this chain is particularly long (say, longer
than 10 elements), then it might be a good idea to try a different
hash function.