Hopefully the comments in the code provide sufficient explanation.
This is something I use on scalaz's Order very often, and to be honest I'm not sure what people do without it on the standard library's Ordering. What do people do when they want to sort a list, comparing items first by one field then by another?
Sorry, the law-testing is pretty gross. Please do let me know if you have a better alternative, and I'm happy to make a change.
Hopefully the comments in the code provide sufficient explanation.
This is something I use on scalaz's
Order
very often, and to be honest I'm not sure what people do without it on the standard library'sOrdering
. What do people do when they want to sort a list, comparing items first by one field then by another?Sorry, the law-testing is pretty gross. Please do let me know if you have a better alternative, and I'm happy to make a change.