Proposal: Add the unordered-containers package and the hashable package to the Haskell Platform

Isaac Dupree ml at
Fri Mar 22 15:40:16 CET 2013

On 03/21/2013 05:32 PM, Johan Tibell wrote:
> I think the contract should be: the hash function is guaranteed to
> return the same hash code for a given value as long as the code is
> compiled with the same version of hashable, unless the user explicit
> turns on hash randomization (i.e. random seed read from /dev/urandom). I
> don't think we should make any guarantees that a new version of hashable
> won't change the hash function used.

That sounds like the right contract for a hashtable hashing function to 

> As for word sizes the only practical thing is to use the native word
> size, as anything else is much too slow (i.e. Int64 is terribly slow on
> 32-bit platforms).

Yeah.  And Int32/Word32 hashes don't work for containers with more than 
2^32 items.  Alright.

> If you're persisting your hashes you
> should use a hash function that guarantees exactly which algorithm is used.

Yep.  But it won't/can't use this Hashable API (e.g. via newtype 
CrossPlatformDeterministicallySipHashed), because of the variable word 
size.  I accept this.


More information about the Libraries mailing list