[firstname.lastname@example.org: Re: [GHC] #1218: Add sortNub and sortNubBy to
jmaessen at alum.mit.edu
Tue Mar 20 22:16:18 EDT 2007
On Mar 20, 2007, at 6:53 PM, Duncan Coutts wrote:
> On Tue, 2007-03-20 at 14:11 +0100, Nils Anders Danielsson wrote:
>> On Tue, 20 Mar 2007, Duncan Coutts <duncan.coutts at worc.ox.ac.uk>
>>> H98 requires that Eq and Ord be equality classes and total orders
>> Does it? I was under the impression that a compiler can never assume
>> that any laws hold of any user-defined instances (to do
>> for instance).
>> The report states the following:
>> "The Eq class provides equality (==) and inequality (/=) methods."
>> "The Ord class is used for totally ordered datatypes."
>> I interpret this as being mere usage guidelines, and nothing more.
Hmm, I've always taken these to be binding contracts. For example,
do I get to assume either == or <= are transitive? But I admit this
is at the level of writing libraries---so that, as another poster
noted, I'm allowed to use a sort function which yields a different
result (possibly _|_) if I don't obey the contract.
But I'd often like my compiler to assume that <= is transitive...
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2425 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/libraries/attachments/20070320/17c5d40f/smime.bin
More information about the Libraries