On Mon, Feb 25, 2002 at 04:27:56PM -0000, Simon Marlow wrote:
> 
> This is a known problem with the Haskell grammar.  Another example in
> a similar vein is
> 
>       let x = 3 in x == 4 == True
> 
> which should parse as
> 
>       (let x = 3 in x == 4) == True
> 
> according to the "extends as far to the right as possible" rule,
> because '==' is nonfix.  In order to do this, the parser must have
> access to the fixity information for '==', which is unreasonable
> (fixity declarations can even be local to a binding group).

I'm not sure I agree with you here. By this point we have lexed and
applied the layout rule so all the braces and semi-colons are in place.
Extracting the fixity information is fairly easy Noticing when operators
are redefined (thus dropping fixity information) is slightly trickier
but still doable, and then all you have to do is annotate your tree
appropriately. Further, if you first construct a tree of blocks then
this can all be done in linear time I believe.

I don't see that this is a forced change; it seems to be purely to make
implementors lives easier (maybe I am just bitter from spending a while
thinking about and implementing this myself!) and makes some previously
legal scripts illegal.


Thanks
Ian

_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to