New Layout Rule

John Meacham john at
Fri Dec 8 16:50:54 EST 2006

On Fri, Dec 08, 2006 at 03:26:30PM +0000, Ian Lynagh wrote:
> On Fri, Dec 08, 2006 at 02:33:47AM -0800, John Meacham wrote:
> > Motivated by some recent discussion, I thought I would explore the
> > possibilty of formalizing the haskell layout rule without the dreaded
> > parse-error clause, as in, one that can be completly handled by the
> > lexer.
> There was some discussion about that a while ago on this list, e.g.
> and other subthreads in that thread.
> I'd still love to see a replacement which can be a separate phase
> between lexing and parsing, even if it means we need to lay some things
> out differently or tweak other bits of the syntax.

"let" isn't an issue (at least not for the reason specified in that
mail). It is taken care of properly in the version I posted. the trick
is to annotate each layout context with what caused it to occur. when
you reach an "in" rather than popping up to the most recent NoLayout
(as you would with a bracket) you pop up to the most recent layout
context that was started with a "let". (if such a context doesn't exist,
it is a syntax error)


John Meacham - ⑆⑆john⑈

More information about the Haskell-prime mailing list