Ambiguous implicits when requesting Eq when both Hash and Order are present
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 5.5k
- Forks
- 1.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 5
Description
Now that the RC ship has sailed, I don't know if this should be addressed at all.
Due to the fact that PartialOrder and Hash both extend Eq, we will run into ambiguous implicits when writing:
def fun[A:Hash:Order](x: A, y: A): Boolean = {
x === y
}
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 have Hash only depend implicitly on Eq (I guess that's the solution used in the cats-mtl library, right?)
Pinging @ctongfei
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the fun[A:Hash:Order] example and inspect how PartialOrder, Hash, Order, and Eq are related. Done would require a decided approach to resolving the ambiguous implicits and agreement that the change should be made.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100