Mode for ghc --make which only compiles the files I pass on command line
Here are a few situations where GHC picks up "too many" files when running
- Suppose a user doesn't add enough modules to
other-modulesin Cabal. GHC will happily pick up extra source files, but those files won't get bundled in the
sdistor be included in ABI computation. Difficult for Cabal to tell when this has happened.
- Suppose the user wants to define multiple internal libraries, and give them the same hs-source-dir. This won't work: because GHC sees the source file it will prefer it over the external dependency.
There's a very easy thing that GHC could do to make this better: add a mode to
--make which says "only compile the files that are explicitly passed on the command line." Something like
ghc --make --only A.hs will only build A.hs, and error if you try to import B.hs.
Seems like this should be fairly easy to do, and would help solve a lot of problems related to GHC slurping up too many files.
(I've assigned myself because this is a blocker for backpack, but if someone wants to take a crack at this be my guest.)