typelevel / algebra

Experimental project to lay out basic algebra type classes
https://typelevel.org/algebra/
Other
378 stars 69 forks source link

Add Order.whenEqual and Monoid[Order[A]] #115

Closed ceedubs closed 8 years ago

ceedubs commented 8 years ago

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.

ceedubs commented 8 years ago

Thanks for the feedback. I'll follow up with changes. Hopefully within the next few days.

ceedubs commented 8 years ago

I've updated my PR based on the provided feedback.

johnynek commented 8 years ago

Looks nice.