Skip to content

ghc --make reports bad import errors too eagerly

Consider this A.hs file, with a valid header (no B.hs file) and a syntax error:

module A where
import B

= as7df89a235r a23jk @A#$(&#$A 

We get different behavior when one-shot compiling and make compiling:

ezyang@sabre:~$ ghc -c A.hs

A.hs:4:1: parse error on input `='
ezyang@sabre:~$ ghc --make A.hs

A.hs:2:8:
    Could not find module `B'
    Use -v to see a list of the files searched for.

I feel like the --make error is wrong, and we shouldn't actually complain that an import is missing until we build it. But it cuts both ways; if you have a big module graph and you try to --make, currently --make will report instantaneously if any import is wrong; if we changed this behavior, --make would chug along until it actually tried to compile the offending file.

It's easy to fix and I can easily submit a patch for it, if people think we should defer the error. Doing this will also let me remove a grievous hack from my fix to #11244 (closed).

Trac metadata
Trac field Value
Version 7.11
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