David MacIver wrote:
> trait Hasher[-T]{
> def hashOf(x : T) : Int;
> def areEqual(x : T, y : T) : Boolean;
> }
>
> this is then used to define the hashing behaviour of the collection,
> much like Ordering. However there would be an implicit Hasher[Any]
> available, so it would always succeed, but could specialise in some
> cases.
>
>
Unfortunately, if you supply an implicit Hasher for a more specific type
than Any, it will not be selected over the one for Any. This is because
Hasher is a contra-variant type constructor. This is from the top of my
head, since I ran into this recently.
--
Tony Morris
http://tmorris.net/