-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add Order and PartialOrder For SortedMap #4092
Conversation
I'm a bit nervous here.
So, a few solutions to my objection:
In any case, I don't see how the PartialOrder should take only a |
kernel/src/main/scala/cats/kernel/instances/SortedMapInstances.scala
Outdated
Show resolved
Hide resolved
I see what you're saying. The interaction between They way I wrote it is consistent with what we already do for
Would you prefer I change it to use the I'm torn because in the Scala stdlib
Which is the opposite of how we canonically think of All that said, I'm fine with which ever strategy is preferred.
I was attempting to be consistent with this:
We used to have a |
It makes the code confusing, and it is _possible_ that someone is using an implementation of SortedMap which doesn't have a precomputed size.
fc1fe42
to
48f6909
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comment.
I think this is the way to go. Yes it is somewhat unsafe to have multiple typeclasses in play at the same time, but I think that risk already exists in many places and it is not something we can easily fix in a small PR.
It would require a real significant design change at least to structures that are built using typeclasses (Sets, Maps, Heaps come to mind).
kernel/src/main/scala/cats/kernel/instances/SortedMapInstances.scala
Outdated
Show resolved
Hide resolved
@johnynek I've removed the unneeded constraints. Thanks for catching that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the effort on this.
@satorg would you be able to take another look here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks!
No description provided.