
"Cristian Baboi"
On Fri, 11 Jan 2008 09:11:52 +0200, Lennart Augustsson
wrote: Some people seem to think that == is an equality predicate. This is a big source of confusion for them; until they realize that == is just another function returning Bool they will make claims like [1..]==[1..] having an unnatural result. The == function is only vaguely related to the equality predicate in that it is meant to be a computable approximation of semantic equality (but since it's overloaded it can be anything, of course).
So let's imagine:
ones = 1 : ones
ones' = repeat 1 where repeat n = n : repeat n
(==) :: Eq a => a -> a -> Bool
-- what is (y (y) ) by the way ? -- how about ( y id ) ?
y f = f (y f).
ones :: Num a => [a] ones = y (1 :)
repeat :: a -> [a] repeat = \n -> y (n:)
ones' :: Num a => [a] ones' = repeat 1 = (\n->y(n:)) 1 = y (1 : )
To be able to test them for equality, we must have Eq a.
So, the reason we cannot test them for equality is that we cannot test y (a : ) == y (a : ) where a == a is testable.
Yes, thanks. I actually do think that many things would be easier if every recursion would be translated to its fixpoint, making the term tree completely finite and defining y internal, as it's arcane, black magic. -- (c) this sig last receiving data processing entity. Inspect headers for past copyright information. All rights reserved. Unauthorised copying, hiring, renting, public performance and/or broadcasting of this signature prohibited.