state of the cabal (preprocessors)

Malcolm Wallace Malcolm.Wallace at
Tue Oct 19 13:02:41 EDT 2004

Ross Paterson <ross at> writes:

> Hugs's implementation of -F is a bit clunky:
> - it slows everything down (Hugs examines most modules twice: first
>   to get the imports and later to actually read the whole thing, so a
>   preprocessor gets run twice)
> - error handling is terrible

Yeah, probably a bad idea to force cpp on all users, whether they
want it or not.

> I agree with Henrik about doing the preprocessing for Hugs at installation
> or packaging time, so that users don't need the full environment.
> That's what currently happens with the fptools libraries.

OK, so I think we are probably agreed on this then:

  * When Cabal is installing for Hugs, it does 'cpp -D__HUGS__'
    (or equivalent) on all Haskell source files, as it copies them
    into the installation location.

If any more complicated situations arise between the ordering of
cpp and other preprocessors, use a chain of file extensions to
disambiguate?  e.g.
   .ly.cpp  = cpp first -> .ly, then literate happy to get .hs file.  = literate happy -> .cpp.hs, then cpp to get plain .hs file.


More information about the Libraries mailing list