cabal executable using local hsc modules

Andreas Voellmy andreas.voellmy at
Mon Mar 25 18:46:08 CET 2013

OK, I just realized that the correct way of handling this is to use the
"other-modules" field of the executable section. In this instance, just
adding "other-modules: A" in the executable section allows the .hsc file to
be found and compiled properly.

Henning: thanks very much for your replies!

On Mon, Mar 25, 2013 at 1:22 PM, Henning Thielemann <
lemming at> wrote:

> On Mon, 25 Mar 2013, Andreas Voellmy wrote:
>  Yes, If I rename A.hsc to A.hs, it works fine (without the
>> "build-depends: foo" in the cabal file).
> Then it may work by accident, since GHC finds the module A in the same
> directory as B. Am I right that GHC recompiles A when it compiles B? This
> should not happen, since GHC should only use the modules the are explicitly
> listed in a section (library or executable). However Cabal calls 'ghc
> --make' and this fetches modules automatically even if Cabal does not tell
> it to do so.
> If library and executable would use different directories
> (Hs-source-dirs), it might not work, as expected.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list