Underscores in qualified names in HsParser

Anders Lau Olsen alauo at mip.sdu.dk
Sat Jul 13 20:32:45 EDT 2002


HsParser is confused by the combination of qualified names and
identifiers starting with underscores. For example:

    module M where

    _f _ _ = 0

    x = 0 `M._f` 0 -- parse error at '.'

    y = M._f 0 0 -- parses as M . (_f 0 0)

I have tested this only for GHC 5.02. For what it's worth, I am pretty
sure the later versions behave the same, and that the fix is to
replace line 336 in Lexer.hs

    | isLower c -> do		-- qualified varid?

with

    | isLower c || c == '_' -> do	-- qualified varid?


Anders




More information about the Glasgow-haskell-bugs mailing list