GHCI Can't Find Module But GHC Can

Malcolm Wallace
Thu, 27 Jun 2002 12:13:30 +0100

> > 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.
> Using an improper parser sounds a little delicate.

I agree it can be delicate, but there is no real need for a full
Haskell parser.  For instance, hmake manages just fine with a
simplified parser that understands only token streams introduced by
the keyword 'import' at the beginning of a line, modified by respecting
cpp directives and Haskell comments.

Hmake takes the safer route of invoking cpp if any cpp directives
were found, but if ghci takes the simpler option of simply flagging
an error, it should be pretty easy to fix.