prefix operators

Ian Lynagh igloo at earth.li
Tue Jul 20 18:13:13 EDT 2010


On Tue, Jul 13, 2010 at 01:52:36PM +0100, Simon Marlow wrote:
>
> Yes, Ian Lynagh implemented your algorithm in GHC (with several tweaks  
> to implement some of the darker corner cases, I believe).  There's also  
> -XAlternativeLayoutRuleTransitional but I'm not sure what that does.

It adds a couple of rules to accept (but whine about) the two most
common problems with the alternative layout rule:
    `where' clause at the same depth as implicit layout block
    `|' at the same depth as implicit layout block

> There are cases that you can't reasonably handle this way, e.g.
>
> g = (let x, y :: Int; (x,y) = (1,2) in x, 3)
> f xs = [ do x | x <- xs ]
>
> My feeling is that if we were to do layout this way it would have to be  
> a simplified version of the current algorithm, so that it is easy to  
> explain both to users and in the report.  Perhaps restricting the tokens  
> that can prematurely end a layout context to just the important ones,  
> like ) ] } 'in'.

I think I agree that a simpler rule, but more breakage of existing code,
would be better. I don't expect I'll have time to do the necessary
experimentation etc in the H2011 timeframe.


Thanks
Ian



More information about the Haskell-prime mailing list