Skip to content

GHC matches -- as a varsym when lexing a qvarsym

GHC seems only to exclude the line comment marker -- when lexing a varsym and not a qvarsym.

This can be observed in the following code

module Demo where

x Demo.-- y = (x,y)

Generating this surprising error message

/Users/emertens/Desktop/Demo.hs:3:3: error:
    Qualified name in binding position: Demo.--

and excludes this definition perhaps?

example f = Just.-- comment
            f

Which might either have lexed as Just . -- comment, or it might have lexed as Just.- -, but it probably shouldn't be the case that it's a qvarsym.

At a minimum, the Haskell Report specifically excludes -- from the varsym rule, so it can't support the qvarsym rule match that it is now.

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