[Haskell-cafe] Functions are first class values in C

Cristian Baboi cristian.baboi at gmail.com
Sat Dec 22 10:22:33 EST 2007


On Sat, 22 Dec 2007 17:13:55 +0200, Philippa Cowderoy <flippa at flippac.org>  
wrote:

>>
>> function's expansion is ... just like macro expansion.
>
> No, it's not. Expanding variables (swapping f1 for \x->x+1) isn't the
> evaluation mechanism in haskell, g and h really are semantically
> equivalent values and we can't do actual computation just by expanding
> variables. Whereas expanding a macro is equivalent to beta-reduction
> (evaluating a function application), which isn't required before passing
> something in Haskell. We pass functions, not just their results.
>
> 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




More information about the Haskell-Cafe mailing list