cats icon indicating copy to clipboard operation
cats copied to clipboard

Ambiguous Vector instances

Open durban opened this issue 6 years ago • 2 comments

The implicits catsKernelStdPartialOrderForVector and catsKernelStdHashForVector (here) are ambiguous if A has both PartialOrder and Hash instances, and we're looking for an Eq[Vector[A]]. (List seems to have the same problem.)

durban avatar Jun 14 '19 13:06 durban

I am not sure if we can fix it for Scala 2.11 without breaking BC. We might have to leave it as is on 2.11 and do a scala version specific fix for 2.12+. Or we simply drop 2.11 which is more likely now than before.

kailuowang avatar Jun 14 '19 15:06 kailuowang

The fix in #3100 ended up breaking bincompat (MiMa missed it), so we had to revert it for now.

travisbrown avatar Nov 26 '19 07:11 travisbrown

Hi! I tried to replicate this error in Scala212, Scala213 and Scala3 with the following script:

import cats._

type A = String // tried also with Int, List[Int]

// checked that A has a both instances
implicitly(PartialOrder[A])
implicitly(Hash[A])

// replicate implicit ambiguity error
implicitly(Eq[Vector[A]])
implicitly(Eq[List[A]])

And got successful executions every time. Let me know if there is another situation that breaks, but otherwise the issue could be closed.

UlisesTorrella avatar Jan 21 '23 22:01 UlisesTorrella

Thanks!

armanbilge avatar Jan 21 '23 22:01 armanbilge