[Haskell-cafe] how do cabal internal libraries work?

Evan Laforge qdunkan at gmail.com
Thu May 24 03:10:55 UTC 2018

On Wed, May 23, 2018 at 3:50 PM, Oleg Grenrus <oleg.grenrus at iki.fi> wrote:
> Hi Evan,
> the cure to your problem is to put source files of different components
> into different directories. i.e.

Yes, that's exactly it!  Thanks for the explanation.

> Even Cabal tells GHC that "Foo.Public" is the only module it need to
> compile, GHC "discovers" ./Foo/Internal.hs and happily uses it.
> There are other similar interactions because of that implicitness, I'd
> advice to avoid having current directory "." (the default) in the
> hs-source-dirs.

Indeed, though it's an awkward and surprising limitation, to me at
least.  I would think ghc would be looking for
dist/build/library/Foo/Internal.hi, and not find it.  I assume it has
to do with ghc --make is sort of a build system, and cabal is sort of
a build system, and they sort of cooperate with each other :)

More information about the Haskell-Cafe mailing list