[Haskell-cafe] Comparing on multiple criteria

Martijn van Steenbergen martijn at van.steenbergen.nl
Wed Dec 24 18:10:48 EST 2008


David Menendez wrote:
> This is a great example of why it's a bad idea to introduce new
> functionality with a Monoid instance. Even if you know the instance
> exists, mappend is so general that it's difficult or impossible to
> predict what it will do at a given type.
> 
> There should be an explicit function for combining Ordering values
> lexicographically, with a note in the documentation saying that it's
> the basis of the Monoid instance.

Agreed.

Supposing such an explicit function exists (with proper documentation), 
would the original example be worth mentioning in or around comparing's 
documentation? If it saved the next user a couple of minutes of coming 
up with something similar, I'd be happy.

Martijn.


More information about the Haskell-Cafe mailing list