RFC: Adding a Hashable type class and HashMap/HashSet data types
to HP
Johan Tibell
johan.tibell at gmail.com
Sat Nov 20 13:13:12 EST 2010
On Sat, Nov 20, 2010 at 3:53 PM, Maciej Piechotka <uzytkownik2 at gmail.com> wrote:
> 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?
I can think of a few. Regardless, constraining the type class in this
way doesn't really buy us anything.
Johan
More information about the Libraries
mailing list