ghci finding include files exported from other packages?

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Sun Mar 15 08:27:48 EDT 2009


On Sat, 2009-03-14 at 23:43 -0700, Conal Elliott wrote:
> The applicative-numbers package [1] provides an include file.  With
> ghci, the include file isn't being found, though with cabal+ghc it is
> found.
> 
> My test source is just two lines:
> 
> {-# LANGUAGE CPP #-}
> #include "ApplicativeNumeric-inc.hs"
> 
> I'd sure appreciate it if someone could take a look at the .cabal file
> [2] and tell me if I'm doing something wrong.  And/or point me to one
> or more working examples of cabal packages that export include files
> that are then findable via ghci.

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.

So if you did ghci -package applicative-numbers then it should work. I'm
afraid I don't have any good suggestion for how to make it work with
ghci without having to specify any options at all.

Duncan



More information about the Glasgow-haskell-users mailing list