[Haskell] Re: comment vs varsym

Simon Marlow simonmar at microsoft.com
Mon Dec 12 09:10:54 EST 2005

On 09 December 2005 05:47, Taral wrote:

> On 12/8/05, Taral <taralx at gmail.com> wrote:
>> or b) comment, because the maximal munch rule says so (it matches
>> the newline): 
>> comment -> dashes [any<symbol> {any}] newline
>> varsym -> (symbol {symbol | :})<reservedop | dashes>
> Aha. Maximal munch only applies to non-whitespace, so Hugs is right.
> Yay. 

This looks like a mistake in the syntax.  I think GHC is following the
letter of the spec, but I also think that the intended behaviour was to
admit --: as a varsym, i.e. Hugs' behaviour.

The syntax allows --: to be a comment, because the class of characters
"symbol" does not include :.  In contrast, the syntax does *not* admit
varsyms beginning with '--' as comments.

I'm not aware of maximal munch being applied only to non-whitespace;
does it say so anywhere in the report?


More information about the Haskell mailing list