using the GHC parser and renamer

Simon Peyton-Jones simonpj@microsoft.com
Thu, 25 Jan 2001 04:41:31 -0800


Kate

I'm sorry not to have replied to your earlier message; I've been
away at POPL etc.  Incidentally, for implementation-related
things, better to use glasgow-haskell-bugs (albeit it's not actually a
bug)
rather than glasgow-haskell-users.

GHC 4.08 (which is the place from which you got your code, I think)
uses a "driver" written in perl to coordinate its operations.  The
driver
runs cpp, then GHC itself (a binary called 'hsc'), then gcc, then as,
then ld.
Run ghc-4.08 with "-v" to see what it does.

My bet is that you are running your bits-of-ghc-plus-bits-of-your-own
binary directly.  So it's not getting all the command-line flags it
expects.
(nor are they documented, because it's an internal interface).

| 	Main.hs:1:
| 		Could not find interface file for 'Prelude'
| 		in the directories ./*.hi

It's not looking in the right directories because it hasn't been told
to do so by the command-line flags.  If you run ghc-4.08 -v you'll
see how the driver communicates which directctories to look in.

| 	Main.hs:3:
| 		Bad interface file::  ./ParseAndRenameFile.hi
| 		./ParseAndRenameFile.hi:1  Interface file=20
| 	version error; Expected 0
| 	found version 408

The version number it expects to find is again communicated by
a command line flag.  For your purposes you may not care, so
one option is to just remove the test.  Or ghc-4.08 -v will show
you what the driver is saying to hsc.




Incidentally, Tim Sheard at OGI is building a modular front end for
Haskell, in the spirit of Mark Jones's Typing Haskell in Haskell paper.
It might be worth asking him whether it's in a borrow-able state,
becuase
it's probably less of a monster than GHC.

Simon