[Haskell-cafe] A useful trick for inclusion and exclusion of commented code

Sven Panne Sven.Panne at aedion.de
Mon Apr 12 14:34:19 EDT 2004


Wolfgang Jeltsch wrote:
> does this trick also work with GHC?  I think that GHC needs a space after -- 
> if these two dashes shall introduce an one line comment.

It works with GHC, too, and this conforms to the H98 report, section 9.2
(Lexical Syntax):

    http://haskell.org/onlinereport/syntax-iso.html#sect9.2

The main reason for this to work is that the braces are classified as "special".
If they were classified as "symbol", '--}' would be a "varsym", not the start
of a comment.

Cheers,
    S.





More information about the Haskell-Cafe mailing list