-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ambiguous implicits when requesting Eq when both Hash and Order are present #2012
Comments
Note: I ran into the same problems in Spire, and we tried to use self-types to hide the subtyping. trait Hash[A] {
self: Eq[A] =>
} but specialization ruins the party. |
Ah this problem surfaced again. I wonder what is your usage for |
Trying to come up with an example, maybe that's not a big deal after all. I started to write a PR to explore what a Let's not forget that |
One could always do |
this is not dissimilar to you could do |
Now that the RC ship has sailed, I don't know if this should be addressed at all.
Due to the fact that
PartialOrder
andHash
both extendEq
, we will run into ambiguous implicits when writing:One solution is to cap the hierarchy by defining
HashPartialOrder
,HashOrder
in libraries that depend on cats, at the loss of some interoperability. Another option is to haveHash
only depend implicitly onEq
(I guess that's the solution used in thecats-mtl
library, right?)Pinging @ctongfei
The text was updated successfully, but these errors were encountered: