[Haskell-cafe] Layout rule (was Re: PrefixMap: code reviewrequest)

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Mon Mar 6 06:30:26 EST 2006

Brian Hulley wrote:
> However I think there is an error in the description of this in
> section 2.7  of the Haskell98 report, which states:
> "If the indentation of the non-brace lexeme immediately following a
> where,  let, do or of is less than or equal to the current indentation
> level, then  instead of starting a layout, an empty list "{}" is
> inserted, and layout  processing occurs for the current level ..."
> I dispute the "or equal" in the above statement, since it seems to be 
> clearly in contradiction to what is actually being done.

Section 2.7 does say that it is an informal description, so although it
is correct, it is not complete.  In the case of the module header, the
question is really "what is the current indentation level?" (that we
must be strictly greater than).  The answer can be found in the formal
definition of the layout rule in section 9.3.  At the beginning of the
module, there is _no_ current indentation level - thus the fourth
equation of L applies.


More information about the Haskell-Cafe mailing list