Thanks for the clarification, Duncan.  Seems an easy partial solution would be a single pass (before CPP) that notices just the #include directives.  Consult the package database to find those packages.  That route would find direct includes but not indirect ones.  An optional and still-easy next step would be to look inside those includes for further #include directives.  I'm unsure whether the cabal solution is as powerful as the single-level include method or the recursive one.

   - Conal

On Sun, Mar 15, 2009 at 2:34 PM, Duncan Coutts <duncan.coutts@worc.ox.ac.uk> wrote:
On Sun, 2009-03-15 at 09:13 -0700, Conal Elliott wrote:
> 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.

But that's because of the circularity I described. GHC can chase Haskell
imports because it can parse Haskell, but chasing CPP #includes would
require us to re-implement cpp. Perhaps we could do it by modifying
cpphs.

Duncan