Skip to content

Wrong error message on attempted import of undefined record field

Test case:

A.hs:

module A where
data AData = AData {right :: ()}

B.hs:

module B where
import A (AData(wrong))

What happens (7.0.2 on Linux):

$ ghc --make B
[1 of 2] Compiling A                ( A.hs, A.o )
[2 of 2] Compiling B                ( B.hs, B.o )

B.hs:2:11:
    In module `A':
      `AData' is a data constructor of `AData'
    To import it use
      `import A (AData (AData))'
    or
      `import A (AData (..))'

It is clear from the syntax of the import that AData is referring to the type, not the constructor. The actual problem is that the field name is undefined.

Trac metadata
Trac field Value
Version 7.0.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
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