
22 Aug
2007
22 Aug
'07
4:43 a.m.
Hi
Other rules that could be interesting are:
forall a b. fromInteger a + fromInteger b = fromInteger (a + b) forall a b. fromInteger a * fromInteger b = fromInteger (a * b)
This is wrong, since the class function can do what it wants. Imagine: instance Num String where (+) = (++) fromInteger x = show x 1 + 2 :: String this expression now goes from "12" to "3" by applying this rule. You need to be incredibly careful if there are any classes floating around. Thanks Neil