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

Maciej Piechotka uzytkownik2 at gmail.com
Sat Nov 20 09:53:03 EST 2010


On Fri, 2010-11-19 at 10:48 +0100, Gregory Collins wrote:
> On Thu, Nov 18, 2010 at 11:05 PM, Johan Tibell <johan.tibell at gmail.com> wrote:
> 
> > * A type class for things that can be hashed, Hashable.
> >
> > class Hashable a where
> >    hash :: a -> Word
> 

Shouldn't it be:

class Eq a => Hashable a where
	hash :: a -> Word

Or is there useful case where we want to hash something but it cannot be
member of Eq?

> BTW,
> 
> An issue that needs to be resolved is: "Where should this change go?" We have a
> couple of options:
> 
>   a) Bring http://hackage.haskell.org/package/hashable into the platform
> 
>   b) Put the module into base -- probably a -1 for political/logistical reasons
> 

I'd say base - there is Data.HashTable in base so adding function:

new' :: Hashable key => IO (HashTable key val)

would belong there

>   c) Put it into containers -- probably a -1 because it would force a
>      containers dependency where there was no containers dependency before.
> 
> Any other ideas?
> 
> G

Regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/libraries/attachments/20101120/01623570/attachment.bin


More information about the Libraries mailing list