RFC: Adding a Hashable type class and HashMap/HashSet data types to HP

Isaac Dupree ml at isaac.cedarswampstudios.org
Thu Nov 18 19:15:29 EST 2010

On 11/18/10 18:39, Daniel Peebles wrote:
> I like this idea. As I mentioned on IRC, I'd call the class Hash rather than
> Hashable. I'm also with you on the Word return type. It may be less
> convenient but maybe this will be a tiny step towards the "great Word
> revolt" (in which all conceptually unsigned things in the prelude and
> standard libraries actually become unsigned) that I hope will occur sometime
> in the near future.

"great Word revolt"?  Don't do it.  Not that way.  It's a risky 
proposition in C, and the Haskell types work the same way, except 
they're called "Word" instead of "unsigned".

For example, on my machine,

 > (1 - 2) :: Word

However, I'm mildly in favor of hash results being Words, because 
they're not supposed to be used as meaningful numbers anyway.  Int is 
good for numbers that are moderately meaningful.  These hashes are more 
like bit-sequences, where -- if arithmetic is used at all -- Word's 
modular nature is what we *want*, and its equal treatment of the top bit 
is what we want (vs. being related to the number's sign).


More information about the Libraries mailing list