ghci finding include files exported from other packages?

Duncan Coutts duncan.coutts at
Mon Mar 16 17:47:31 EDT 2009

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.


More information about the Glasgow-haskell-users mailing list