Skip to content

One-shot module loops have hard to understand messages

Consider these two modules:

-- A.hs
module A where

-- B.hs
module B where
import A

ghc --make B.hs will compile this fine. Now edit A.hs to be circular:

-- A.hs
module A where
import B

and attempt to one-shot compile it with ghc -c A.hs. You will now get an uninformative error message:

A.hs:1:1: Circular imports: module `A' depends on itself

You can get a more informative message with --make:

Module imports form a cycle:
         module `A' (A.hs)
        imports `B' (./B.hs)
  which imports `A' (A.hs)

We should either suggest users try again with --make, or try harder to give a useful message in one-shot mode.

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