This is a fine warning you both point out, but I would suggest that it distracts from the OP's question.
The previous, germane discussion holds if we assume that i) both f and g have type Integer -> Integer, ii) the compiler writer is not out to get us, and iii) the GMP library, if used by that compiler, is correct. Oh and also that the representations of the Integers involved do not require more memory than the user's computer has to offer. Anything else seem relevant? I do apologize for my noise if the OP was indeed thinking of + and * as unlawful methods of the Num typeclass. A nice property of Haskell is to note that a little confusion of math and Haskell can be very helpful to clear up some existing confusion about Haskell. On Dec 18, 2007 3:31 PM, Bertram Felgenhauer <[EMAIL PROTECTED]> wrote: > Cristian Baboi wrote: > > This is what I "understand" so far ... > > > > Suppose we have these two values: > > a) \x->x + x > > b) \x->2 * x > > Because these to values are equal, all functions definable in Haskell must > > preserve this. > > Oh but you can distinguish these functions. Consider > > > a x = x+x > > b x = 2*x > > > > data T = A | B deriving (Show, Eq) > > > > instance Num T where > > _ + _ = A > > _ * _ = B > > > > f :: (T -> T) -> T > > f y = y undefined > > > > main = print (f a) >> print (f b) > > which prints A, then B. > > The key point here is that a and b have type (Num a => a -> a) and > while well behaved Num instances certainly can not distinguish a and b, > artificial ones like above can. > > Enjoy, > > Bertram > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe