How does GHC implement layout?

Ian Lynagh igloo at earth.li
Mon Apr 5 20:24:53 UTC 2021


On Sun, Apr 04, 2021 at 05:18:52PM -0500, Alexis King wrote:
> On 4/4/21 1:52 PM, Iavor Diatchki wrote:
> > 
> > Overall, I do think that Haskell's layout rule is more complicated than
> > it needs to be, and this is mostly because of the rule that requires the
> > insertion of a "virtual close curly" on a parse error.
> 
> Yes, this does seem to be by far the trickiest bit. But I’d be sad not to
> have it, as without it, even simple things like
> 
>    let x = 3 in e
> 
> would not be grammatically valid.

That is accepted by the AlternativeLayoutRule.


Thanks
Ian



More information about the ghc-devs mailing list