Discovery of source dependencies without --make

Lars Hupel lars at hupel.info
Fri Nov 28 16:26:03 UTC 2014


> How does that differ from ghc --make?  The only difference I can see is that
>   - Modules that --make might find, but not listed on
>     the command line, would not be compiled by --topo-sort

"--make" always requires a full view on all sources. That is, any
imports which cannot be resolved from the package database are assumed
to exist as source files. Imagine the following situation:

A.hs
> module A where
>
> import B
> import Library

B.hs
> module B where

If I compile these two with "--make", it also needs "Library.hs" as
input. If I compile them without "--make", it just needs the interface
("Library.hi") as additional input.

Concretely, assuming that only "path/Library.hi" exists, this fails:

  ghc -c -ipath --make A.hs B.hs

In contrast to that, I propose that this should work:

  ghc -c -ipath --topo-sort A.hs B.hs


More information about the Glasgow-haskell-users mailing list