ghci finding include files exported from other packages?

Conal Elliott conal at
Sun Mar 15 12:13:35 EDT 2009

That did it.  I've added ":set -package applicative-numbers" to my .ghci and
am back in business.  Thanks!

IIUC, there's an inconsistency in ghci's treatment of modules vs include
files, in that modules will be found without -package, but include files
won't.  Room for improvement, perhaps.

  - Conal

On Sun, Mar 15, 2009 at 5:27 AM, Duncan Coutts
<duncan.coutts at>wrote:

> 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
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Glasgow-haskell-users mailing list