Wolfgang Lux schrieb:
> IMHO, you cannot seriously expect a user
> to write the following code.
>
> instance Eq Bool where
> b1 == b2 = equal (ensureNotFree b1) (ensureNotFree b2)
> where equal False False = True
> equal False True = False
> equal True False = False
> equal True True = True
>
> instance Eq a => Eq (Maybe a) where
> m1 == m2 = equal (ensureNotFree m1) (ensureNotFree m2)
> where equal Nothing Nothing = True
> equal Nothing (Just _) = False
> equal (Just _) Nothing = False
> equal (Just x) (Just y) = x == y
>
> etc.
In these cases I would seriously expect the user to write
data Bool = True | False deriving Eq
data Maybe a = Just a | Nothing deriving Eq
If he really wants an own instance of Eq, it is clearly not for the
standard purposes. So who are we to dictate him that for his special use
all arguments should surely be not free?
_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Di Nov 16 2004 - 10:57:47 CET