state of the cabal (preprocessors)

Simon Marlow simonmar at microsoft.com
Tue Oct 19 09:06:01 EDT 2004


On 19 October 2004 13:42, Malcolm Wallace wrote:

>> Another solution is to adopt a new extension for plain Haskell, say
>> .phs.  The conversion from .hs to .phs is either via CPP or just
>> 'cat', depending on some setting somewhere.
> 
> Not very pretty.

True :-)

>> Also, I recommend that we use the compiler itself for preprocessing:
>> 
>>   ghc -E foo.hs -o foo.phs
> 
> You are right that the compiler is best placed to define pp symbols,
> so this is all very well, but neither nhc98 nor Hugs currently have
> the -E option to stop immediately after pp.  And come to think of it,
> the only real reason to have cpp done separately at all is because
> Hugs does not have a preprocessor call builtin, like ghc and nhc98 do.
> So maybe the best solution is to ship Hugs with -F"cpphs.hugs"
> enabled by default?  Then no separate extension would be required,
> and Cabal could just defer all cpp-ing to the compiler.

That would be fine, except that Cabal might want to get access to the
raw CPP'd source file for two reasons I can think of:

  - calculating dependencies, like hmake does
  - running Haddock

As long as you can do preprocessing with 'ghc -E' or similar (cpphs?)
then everything's fine.

Cheers,
	Simon


More information about the Libraries mailing list