Skip to content

About ambiguous implicit instances in Cats module #95

Closed Answered by gvolpe
Iltotore asked this question in Q&A
Discussion options

You must be logged in to vote

The first reason is the clash with the Eq instance, that's correct. But I think it has to do with how it's defined:

trait Hash[@sp A] extends Any with Eq[A] with Serializable

Versus

trait Order[@sp A] extends Any with PartialOrder[A]

trait PartialOrder[@sp A] extends Any with Eq[A] 

trait Eq[@sp A] extends Any with Serializable

Hash extends Serializable directly, and that seems to affect implicit resolution, but that's just a wild guess. You can see how Eq also extends Serializable, but in the eyes of both Order and PartialOrder it's another layer down in the mixin.

I only know that the low-priority pattern is quite common for typeclass instances, so I just moved this one there and ever…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Iltotore
Comment options

Iltotore Jan 3, 2023
Maintainer Author

@gvolpe
Comment options

Answer selected by Iltotore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants