ghci finding include files exported from other packages?

Duncan Coutts duncan.coutts at
Mon Mar 16 19:17:45 EDT 2009

On Mon, 2009-03-16 at 16:04 -0700, Conal Elliott wrote:
> On Mon, Mar 16, 2009 at 2:47 PM, Duncan Coutts
> <duncan.coutts at> wrote:
>         On Mon, 2009-03-16 at 12:13 +0000, Simon Marlow wrote:

>         > 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

Yes, that's what I said earlier about re-implementing cpp, possibly via
cpphs. That would let you chase #includes and assuming you know which
packages provide which include files then we could work out which
packages are needed for cpp-ing.

Or you could play it fast and loose and assume that you can usually
ignore # cpp lines and still work out what the Haskell imports are most
of the time. That's not correct but is probably easier and would
probably work most of the time.

Neither approach is easy or very nice.


More information about the Glasgow-haskell-users mailing list