GHCI Can't Find Module But GHC Can
Thu, 27 Jun 2002 11:33:45 +0100
> > > I think the problem is that GHCi doesn't respect #ifdef=20
> > > conditional compilation.
> > I wasn't aware of any bugs in that area, can anyone provide=20
> some sample
> > code? (and I'm surprised, because GHCi just runs cpp in=20
> the same way as
> > GHC).
> Ah, I think it is probably just a failure to use the -cpp option on
> the ghci commandline. The error message isn't terribly helpful in
> this regard, since it complains about being unable to find a module
> that wasn't wanted anyway. It might be more useful to complain that
> a cpp # directive was found?
Aha! GHCi (and ghc --make) has a pre-pass that looks through the file
for import declarations so it can build the dependency tree, and it does
this without using a proper Haskell parser. I'll bet it's ignoring the
CPP directives. Probably it should flag an error, I'll look into it.