"Simon Peyton-Jones" <[EMAIL PROTECTED]> writes:

> Ah yes, this is a genuine bug.   Haskell 98 changed at some point to
> allow identifiers and field labels with a leading '_', but the library
> didn't keep pace.

I believe the fix for 'lex' is something like the following.
Regards,
    Malcolm

diff -u -r1.5 Lex.hs
--- src/prelude/PreludeText/Lex.hs      2001/11/09 17:19:06     1.5
+++ src/prelude/PreludeText/Lex.hs      2003/02/10 12:30:00
@@ -26,13 +26,14 @@
 
 lex (c:s) | isSingle c = [([c],s)]
          | isSym c     = [(c:sym,t)         | (sym,t) <- [span isSym s]]
-         | isAlpha c   = [(c:nam,t)         | (nam,t) <- [span isIdChar s]]
+         | isIdInit c  = [(c:nam,t)         | (nam,t) <- [span isIdChar s]]
          | isDigit c   = [(c:ds++fe,t)      | (ds,s)  <- [span isDigit s],
                                               (fe,t)  <- lexFracExp s     ]
          | otherwise   = []    -- bad character
                where
-               isSingle c  =  c `elem` ",;()[]{}_`"
+               isSingle c  =  c `elem` ",;()[]{}`"
                isSym c     =  c `elem` "!@#$%&*+./<=>?\\^|:-~"
+               isIdInit c  =  isAlpha c || c == '_'
                isIdChar c  =  isAlphaNum c || c `elem` "_'"
 
                lexFracExp ('.':c:s) | isDigit c
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to