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

Adrian Hey ahey at iee.org
Wed Mar 12 15:51:54 EDT 2008

Aaron Denney wrote:
> On 2008-03-11, Adrian Hey <ahey at iee.org> wrote:
>> Having tried this approach myself too (with the clone) I can confirm
>> that *this way lies madness*, so in future I will not be making
>> any effort to define or respect "sane", unambiguous and stable behaviour
>> for "insane" Eq/Ord instances for any lib I produce or hack on. Instead
>> I will be aiming for correctness and optimal efficiency on the
>> assumption that Eq and Ord instances are sensible.
> Good.  But sensible only means that the Eq and Ord instances agree, not that
> x == y => f x == f y.

So can I assume that max x y = max y x?

If not, how can I tell if I've made the correct choice of argument
order. If I can't tell then I guess I have no alternative but document
my arbitrary choice in the Haddock, and probably for the (sake of
completeness) provide 2 or more alternative definitions of the "same"
function which use a different argument order.

Adrian Hey

More information about the Haskell-Cafe mailing list