I just uncovered a couple of strange cases in the Haskell lexical syntax.
If you're not especially bothered about such things, don't bother to read
on!

Quick quiz:  how many Haskell lexemes are represented by the following
sequences of characters?

        1)      M.x
        2)      M.let
        3)    M.as
        4)      M..
        5)      M...
        6)      M.!

answers:
        
        1)      1.  This is a qualified identifier.

        2)      3. 'let' is a keyword, which excludes this string
                   from being a qualified identifier.

        3)      1. 'as' is a "specialid", not a "reservedid".

        4)      1. This is a qualified symbol.

        5)      2. '..' is a reserved operator, so a qualified symbol
                   is out.  The sequence '...' is a valid operator and
                   according to the maximal munch rule this must be
                   the second lexeme.

        6)    1. '!' is a "specialop", not a "reservedop".


I especially like case 5 :-)

This is pretty bogus.  I suggest as a fix for Haskell 2 that all of the
above be treated as 1 lexeme, i.e. qualified identifiers/symbols.

Cheers,
        Simon


Reply via email to