ghci finding include files exported from other packages?

Simon Marlow marlowsd at
Tue Mar 17 04:53:33 EDT 2009

Duncan Coutts wrote:
> On Mon, 2009-03-16 at 12:13 +0000, Simon Marlow wrote:
>>> This sounds like a chicken and egg problem. To know which package
>>> include directories to use GHCi needs to know which packages your module
>>> uses. However to work out which packages it needs it has to load the
>>> module which means pre-processing it!
>>> With cabal we get round this problem because Cabal calls ghc with
>>> -package this -package that etc and so when ghc cpp's the module it does
>>> know which package include directories to look in.
>> Perhaps I'm missing something, but if applicative-numbers is an exposed 
>> package, shouldn't we be adding its include-dirs when invoking CPP?
> Yes, if we know we're using it. If we specify -package blah on the
> command line then we do know we're using it and everything works
> (because ghc uses the include-dirs when it calls cpp). If we don't
> specify -package then ghc does not know we need the package until after
> import chasing is done. Import chasing requires that we run cpp on
> the .hs file first and that brings us full circle.

I don't see a reason why we shouldn't pass *all* the include paths for the 
exposed packages to CPP.  Indeed that's what I thought we did, but I've 
just checked and I see we don't.  Wouldn't that fix Conal's problem?


More information about the Glasgow-haskell-users mailing list