Skip to content

GHC --make should also look for .hi, not only for .hs

Currently, ghc --make will only consider .hs source files from the include path.

Example (assuming Library can't be resolved from the package database):

A.hs

module A where

import B
import Library

B.hs

module B where

Compiling these files with ghc --make -Idir A.hs B.hs will succeed only if GHC finds a Library.hs file.

In a thread on glasgow-haskell-users, Simon proposed relaxing this constraint; namely: In --make mode, when encountering an import X, GHC will try the following in order:

  1. resolve the import from a package
  2. search the include path for X.hs or X.lhs
  3. search the include path for X.hi

It already does 1 and 2, and this proposal would add 3.

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