Hello!
On Wed, Sep 15, 1999 at 01:40:49PM +0200, Sven Panne wrote:
> [...]
> Another source of ugliness in the implementation of any Haskell
> parser will probably be the longest-parse rule. Another quiz: Put
> semantic-preserving parentheses around the following expressions:
> if x then y else z + 1
> if x then y else z :: T
This one can be solved with operator precedences (if/then/else being
a ternary operator with a bit strange syntax).
It's
if x then y else (z + 1)
and
(if x then y else z) :: T
However, in this case there would be no semantic difference if it were
if x then y else (z :: T)
as the types of the then and the else branch must unify to yield the
type of the if/then/else construct anyway.
Regards, Hannah.