Preprocessors (was: state of the cabal (preprocessors))

Malcolm Wallace Malcolm.Wallace at
Wed Oct 20 05:37:33 EDT 2004

Ketil Malde <ketil+haskell at> writes:

> I've recently run into a problem using the preprocessor (ghc -cpp).
> It seems it barfs on 's (apostrophe).  Annoying, since naming
> variables something-prime is a fairly common idiom.
> Is this something that has a workaround, or could be fixed?

The main workaround if using traditional cpp is to avoid apostrophes. :-(
On the other hand, cpphs has a more liberal lexical policy, and permits
both apostrophes and backticks within a token.  So, your example

>     let w' = head ... -- breaks

would work fine in cpphs, and other tricks impossible with the
original cpp are also possible, like this:

    #define  `mplus`  +++

The mismatch between C's and Haskell's lexical syntax was one important
motivation for developing cpphs.


More information about the Libraries mailing list