
Alastair Reid
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 ...
It's true that many people layout their code in such a way that this will work.
The hmake parser specifically doesn't depend on layout. A module doing crazy stuff like module M where import qualified {- " -} N is perfectly fine, and all it takes to implement is the addition of a `concatMap' over and above the version which expects the whole import on one line. (FWIW, the hmake parser is ~200 lines, of which ~150 lines deals with cpp, ~30 lines deals with comments, and ~20 lines actually reads the imports.)
But ghci already contains a Haskell parser - so it should be much less work.
Agreed, except that you don't want to fully-parse each module twice, nor in general do you want to report all parse errors on the import-gathering pass! Regards, Malcolm