
On Fri, Nov 26, 2010 at 8:35 PM, Bryan O'Sullivan
I think so. The purpose of having the Hashable typeclass is so that the universe of typed values that we can hash is open.
I don't disagree that being able to hash everything is nice, but I don't think it's crucial. My main interest in having a Hashable type class is so we can have containers that can be keyed by hashable things, for the types where this make sense (e.g. string like types where comparison is expensive.) If all that a Hashable type class would give me is the ability to store ByteStrings and Texts in a HashMap, that alone would be enough motivation for having one in my opinion.
I notice that the Hashable class doesn't have a way to supply a seed. If it did, we could possibly chain the result of one hash as the seed of the next, allowing us to construct a complete hash in an obvious way (although introducing a possibly undesirable data dependency, making it difficult or impossible to hash a large structure in parallel).
Having a hashWith method that takes a seed sounds reasonable. I guess a hash algorithm that doesn't make use of a seed (are there any?) could just throw away the seed in the implementation of hashWith. Johan