Re: [Haskell-cafe] Comparing on multiple criteria

2008-12-21 Thread Jan-Willem Maessen
On Dec 21, 2008, at 8:52 AM, Martijn van Steenbergen wrote: Hello all, Data.Ord has a handy function called comparing, and its documentation shows an example of its use. But what if you want to sort a list of values based on multiple criteria? It turns out there is a neat way to do this:

Re: [Haskell-cafe] Comparing on multiple criteria

2008-12-21 Thread Luke Palmer
On Sun, Dec 21, 2008 at 9:20 AM, Jan-Willem Maessen wrote: > Indeed, this is great to know. I can't help but notice that there is no > documentation of any kind at all for the Monoid instance of Ordering; how > were we supposed to know this behavior existed in the first place, except by > hunting

Re: [Haskell-cafe] Comparing on multiple criteria

2008-12-21 Thread David Menendez
On Sun, Dec 21, 2008 at 11:20 AM, Jan-Willem Maessen wrote: > On Dec 21, 2008, at 8:52 AM, Martijn van Steenbergen wrote: > >> Hello all, >> >> Data.Ord has a handy function called comparing, and its documentation >> shows an example of its use. >> >> But what if you want to sort a list of values

Re: [Haskell-cafe] Comparing on multiple criteria

2008-12-23 Thread Henning Thielemann
David Menendez schrieb: > On Sun, Dec 21, 2008 at 11:20 AM, Jan-Willem Maessen > wrote: >> On Dec 21, 2008, at 8:52 AM, Martijn van Steenbergen wrote: >> >>> Hello all, >>> >>> Data.Ord has a handy function called comparing, and its documentation >>> shows an example of its use. >>> >>> But what i

Re: [Haskell-cafe] Comparing on multiple criteria

2008-12-24 Thread Martijn van Steenbergen
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 functi