
On Tue, 18 Dec 2007, Benja Fallenstein wrote:
Hi Cristian,
On Dec 18, 2007 10:53 AM, Cristian Baboi
wrote: - the lambda expressions can be written (input) but cannot be printed (output)
Yes, since two different lambda expressions can denote the same function. I just want the sistem to be able to print one of these expressions !
Its this too much to ask ? I find it very strange that I can write a lambda expresion, but the system cannot.
It's a trade-off. Haskell has as a design goal that you can use equational reasoning everywhere -- that if you have two ways of writing the same function, you can substitute one for the other in any expression, without changing the result of that expression. For example, since you can prove
sum = foldl (+) 0 = foldr (+) 0 = last . scanl (+) 0
Since this was discussed already here, I summed it up in: http://www.haskell.org/haskellwiki/Show_instance_for_functions