[Haskell-cafe] Functions are first class values in C
cristian.baboi at gmail.com
Sat Dec 22 10:33:39 EST 2007
On Sat, 22 Dec 2007 17:25:34 +0200, Philippa Cowderoy <flippa at flippac.org>
> On Sat, 22 Dec 2007, Cristian Baboi wrote:
>> On Sat, 22 Dec 2007 17:13:55 +0200, Philippa Cowderoy
>> <flippa at flippac.org>
>> > Here's a trivial example that does so:
>> > (\x -> x) (\x -> x)
>> > A lambda calculus classic that doesn't typecheck in Haskell:
>> > (\x -> x x) (\x -> x x)
>> > Feel free to try evaluating it!
>> Thank you for your message.
>> I tryed and this is what I've got:
>> ERROR - cannot find "show" function for:
>> *** Expression : (\x -> x) (\x -> x)
>> *** Of type : a -> a
> Yep, that's because while it can evaluate it down to (\x -> x) your
> interpreter doesn't know how to print the result. You can demonstrate
> it works by then passing in something to that result though:
> ((\x ->x) (\x -> x)) 1
I know that. The reason the interpreter doesn't know how to print the
result is because converting functions to strings doesn't make sense.
> You'll have to evaluate the other one by hand. Don't spend too long with
> it though!
Don't worry, I'm lazy too :-)
More information about the Haskell-Cafe