cabal executable using local hsc modules

Andreas Voellmy andreas.voellmy at gmail.com
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 henning-thielemann.de> 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: <http://www.haskell.org/pipermail/libraries/attachments/20130325/dad6e2a2/attachment.htm>


More information about the Libraries mailing list