ghci finding include files exported from other packages?

Conal Elliott conal at conal.net
Mon Mar 16 19:04:42 EDT 2009


On Mon, Mar 16, 2009 at 2:47 PM, Duncan Coutts
<duncan.coutts at worc.ox.ac.uk>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.
>
> Duncan


Unless you drop the cpp-first requirement and have import-chasing look into
#include'd files, as I described earlier.  - Conal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20090316/f7905410/attachment.htm


More information about the Glasgow-haskell-users mailing list