Preprocessors

Ketil Malde ketil+haskell at ii.uib.no
Thu Oct 21 10:56:05 EDT 2004


Sven Panne <Sven.Panne at aedion.de> writes:

> Furthermore, I don't think that the "C" in CPP is a real problem, at least in
> the traditional mode. 99% of the uses of a preprocessor for Haskell was simply
> for ironing out some platform/implementation differences, nothing very elaborate.

Speaking for the remaining 1%, I use cpp to get better error reporting
for Prelude functions. I.e. I define head, fromJust etc. as macros, so
that if the pattern match fails, I can get the exact place in the
source, instead of an anonymous error message.

'C' becomes a problem in some cases, notably infix operators (which
anyway are problematic, since I cannot surround an arbitrary
expression with backticks and get infix behavior) and single quotes. 

But if there is a better way to do this, I'm all ears.

-kzm

PS: I put my darcs repo at http://www.ii.uib.no/~ketil/interlude
It's really trivial, but feel free to use if and submit improvements.
PPS: Talking about darcs, they (that is, David Roundy) also use this
trick.
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Libraries mailing list