At 09:45 97/05/21, Frank Christoph wrote:

>> | 2.- In the declaration of the Eq class, (/=) has a default declaration,
>> |      but (==) has not. Why?
>> |      If (==) has also a default declaration (ie: not (x/=y)) you could
>>choose
>> |      whether to define (==) or (/=) or both when declaring an instance.
>> |      The same applies to Ord and (<=).
>>
>> I don't know.  It would be sensible for it to have one.
>
>Maybe because if you defined them both, people might accidentally declare
>an empty
>instance, rendering both functions non-terminating.  Such stupid mistakes
>can be
>hard to track down...

  In order to prevent this, one would need to have a way to indicate (in
the base class) which function subsets can be used as primitives. In the
example of Eq, it would be
        { {(==)}, {(/=)} }
(And each such set of primitives could use its own definitions for the
functions not in the primitive set, if needed.)

  Hans Aberg





Reply via email to