[Haskell-cafe] Re: (flawed?) benchmark : sort

Adrian Hey ahey at iee.org
Mon Mar 10 10:53:16 EDT 2008


Bulat Ziganshin wrote:
> Hello Adrian,
> 
> Monday, March 10, 2008, 2:00:18 PM, you wrote:
> 
>>> instance Ord Foo where
>>>     compare (Foo a _) (Foo b _) = compare a b
> 
>> I would consider such an Ord instance to be hopelessly broken, and I
> 
> hmmmm. for example, imagine files in file manager sorted by size or date

In such cases you should be using sortBy, not the overloaded sort
(you have several reasonable orderings for the same record type say).

Regards
--
Adrian Hey







More information about the Haskell-Cafe mailing list