Hi Simon (again!)
| 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.!
Interesting examples! However, I don't agree with your proposed fix, which
is to regard all of them as single lexemes. Instead, I think that the time
has come to find another symbol for composition, and let `.' be a token all
by it's lonesome with the traditional reading of selection. This wasn't an
option for Haskell 98, where it would have been unthinkable (I assume) to
loose (.) as function composition, but it's definitely an option to consider
for any future Haskell 2. With this change, qualified names would be
handled
at the level of the context free grammar rather than the lexical syntax, and
the rules would be much easier to understand. Your six examples would then
be M . x (3 tokens) M . let (3 tokens, not a valid name) M . as (same
again)
M .. (2 tokens) M .. . (3 tokens) M . ! (3 tokens)
I'm assuming that both . and .. would be special tokens, and that . would
not
otherwise be permitted in a symbol or identifier (except as a decimal
point!).
Look at the contortions that we're making to keep . for function
composition!
It has to go! How about ; instead as a nice syntax for forward composition?
(Explicit layout? What's that? Maybe it should go too :-)
All the best,
Mark