Be Consistent About Providing An Ordering Instance
See original GitHub issueWe sometimes have data types which subtype Ordered
and other times have types which implement Ordering
. We only need to do Ordering
. We should ensure that all types which are Ordered
also have an Ordering
instance.
Context: https://github.com/http4s/http4s/pull/5013#discussion_r682655331
Issue Analytics
- State:
- Created 2 years ago
- Comments:22 (22 by maintainers)
Top Results From Across the Web
member-ordering | typescript-eslint
Require a consistent member declaration order. This rule aims to standardize the way classes, interfaces, and type literals are structured and ordered. A...
Read more >Why Comparable natural ordering needs to be consistent with ...
It is strongly recommended (though not required) that natural orderings be consistent with equals. This is so because sorted sets (and sorted ...
Read more >Consistency Guarantees in Distributed Systems Explained ...
Distributed systems are all about choosing the right trade-offs, similarly, we'll shortly see, consistency models are trade-offs between ...
Read more >Frequently Asked Questions About Consistency at Work - Indeed
Consistency minimizes the chance of your work quality decreasing. Provide order in the workplace: If a workplace has several employees that ...
Read more >Understanding Success Criterion 3.2.4: Consistent Identification
The intent of this Success Criterion is to ensure consistent identification of functional components ... Example 3: Consistent references to other pages.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@san-coding if a class is already extending
Ordered
, we need to leave it that way, at least for now. This is so we don’t break binary compatibility.In the context of this ticket, any type in http4s which is currently only extending
Ordered
should also have an implicitOrdering
added, and they should be consistent with each other.Hopefully, most of the types which are extending
Ordered
have acats.kernel.Order
instance. If they do, then adding theOrdering
is very simple. For example,If they don’t have a
cats.kernel.Order
instance (which you are free to add as well if you’d like, or not, either way), as in the case ofHttpDate
, then we’d do something like this.For the sake of consistency, I’d also probably make the
compare
method fromOrdered
and theequals
method (if it’s not a case class) use the underlyingOrdering
instance. Something like,That was a lot of text…let me know if that makes sense and don’t hesitate to reach out if you have questions.
@isomarcte @rossabaker have opened a PR for adding
Ordering
instanceQValue
class