On 06-Oct-1999, John Atwood <[EMAIL PROTECTED]> wrote:
> Can't you trivially satisfy Eq:
> 
> instance Eq b => Eq (a -> b) where
>         f == g          = False

Functions using the `Eq' class might rely on the property
that x == x is True for all x.

So

        instance Eq b => Eq (a -> b) where
                f == g  = error "can't compute equality of functions"

might be safer, in the sense that at worst it would result
in a runtime error, rather than silently producing incorrect
output.

However, a `Show' instance that just printed "<<function>>"
for all functions would probably be OK.

-- 
Fergus Henderson <[EMAIL PROTECTED]>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger [EMAIL PROTECTED]        |     -- the last words of T. S. Garp.



Reply via email to