Skip to content

GHC fails to respect the maximal munch rule while lexing "qualified reservedids"

The following program I believe is legal haskell 98:

module Main where

t = 2
defaul _ = return ()
main = Main.default

since Main.default is an illegal lexeme, but Main.defaul is a perfectly good qvarid. however ghci rejects it:

Bar.hs:5:12: parse error on input `default'

Something very similar to this is documented, but only in the qvarsym case. This appears fairly easy to fix using extra rules in the lexer; a flex lexer that does what I consider correct can be found at http://members.cox.net/stefanor/h98lexer.l.

Trac metadata
Trac field Value
Version 6.6
Type Bug
TypeOfFailure OtherFailure
Priority low
Resolution Unresolved
Component Compiler (Parser)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information