On 10 feb 2010, at 10:40, Sebastian Fischer wrote:


On Feb 9, 2010, at 10:43 PM, S. Doaitse Swierstra wrote:

-- but if we now unfold the definition of one we get a parser error in GHC
increment' = ( let x=1 in x  +  )

The GHC and Hugs parsers are trying so hard to adhere to the meta rule that bodies of let-expressions extend as far as possible when needed in order to avoid ambiguity, that they even apply that rule when there is no ambiguity; here we have only a single possible parse, i.e. interpreting the offending expression as ((let x = 1 in ) +).

Despite the fact that there is a typo (second x is missing), I can think of two possible parses. Actually, my mental parser produced the second one:

  ((let x=1 in x)+)
  let x=1 in (x+)

The Haskell report may exclude my mental parse because operator sections need to be parenthesised.

Indeed, but it is not "may exclude", but "excludes".



Or are you arguing that in your example different possible parses have the same semantics for an arguably obvious reason and that this fact is relevant?

No,

Doaitse



Sebastian


--
Underestimating the novelty of the future is a time-honored tradition.
(D.G.)


_______________________________________________
Haskell-prime mailing list
Haskell-prime@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-prime

Reply via email to