>   And now for a little quiz.  What's the value of the following (legal)
>   Haskell expression?  (Don't try it with hbc, it fails.)
> 
>         let (+) + 1 + 1 = (+)
>         in  1 + 1
> 
> This is illegal syntax!!  (+) and (the second) + are the same
> variable, thus violating the linearity constraint for left-hand-sides!
> It should be as illegal as writing something like:
> 
>   f f = 1
> 
> Isn't that OBVIOUS??  (:-)

NO :-)

Both are legal (as you note earlier for f) -- Lennart's example contains one
of each type of +

        n+k pattern
        (+) as local variable (!)
        + as function name

Annotating the parse tree:

        ((+) {-var-} + 1 {-n+k-}) + {-function-} 1

Perfectly legal, and perfectly horrible.

Kevin

PS      What *do* you put in Swedish cookies, Lennart? :-)

Reply via email to