Distribution.PreProcess

Ross Paterson ross at soi.city.ac.uk
Fri Dec 10 06:28:43 EST 2004


On Tue, Dec 07, 2004 at 09:55:44AM -0800, Isaac Jones wrote:
> Ross Paterson <ross at soi.city.ac.uk> writes:
> > For Hugs, it would be more convenient to preprocess a source
> > tree to make a new tree, especially if cpp turns Foo.hs into Foo.hs.
> 
> We originally had it move all the files into a temporary spot, then
> preprocss, then build.  One problem with that, of course, is the
> threat of an IDE bringing up an error in one of the files that's been
> moved, the user fixing it, running the build again, and having the
> same error.

Perhaps you need two versions:
- one for ghc and nhc98 that leaves the output of preprocessing in the
  same place, and doesn't run cpp.
- one for Hugs that takes an extra argument, a directory to put the
  preprocessed files in, and also optionally runs cpp on each file
  after any other preprocessing.

You could use the same list of suffix handlers for both if you defined

	type PPSuffixHandler = (String, Maybe PreProcessor)

with Nothing meaning do nothing in the first case and copy (or cpp) in
the second.

(Haddock are another kettle of fish.)

Also, in the Hugs case it would be helpful to return the list of names
of the files created, because they may need subsequent compilation with
ffihugs.


More information about the Libraries mailing list