John Meacham john at
Wed Oct 20 22:30:10 EDT 2004

On Wed, Oct 20, 2004 at 10:52:43AM +0100, Henrik Nilsson wrote:
> Hi all,
> Malcolm Wallace wrote:
> >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. :-(
> And this, of course, is one reason why it is good if it is easy to
> run CPP only on those files where it is necessary. (Unless everyone
> uses "cpphs", then, which ultimately would seem like a good idea.)

If we are going to create a haskell-specific preprocessor. then we can
do a lot better than this.

Macros and Preprocessing in Haskell. Keith Wansbrough (1999).

    Abstract: Existing large Haskell systems make extensive use of the C
preprocessor, CPP. Such use is problematic, as CPP is not designed for
use with Haskell code. Certain features of the Haskell report also
indicate a possible deficiency in the Haskell language. This paper
investigates these deficiencies, and proposes two extensions to Haskell:
the inclusion of distfix operators, and the incorporation of a Haskell
preprocessor, HSPP, into the Haskell standard. Related issues are
discussed, including the provision of a general macro facility for

The main advantage of cpp was that it was already available on most
systems and people knew of it. if we are going to create our own
preprocessor, then there is no need to follow cpp's syntax.

The main use of a preprocessor is for cross architecture compatability,
if we don't standardize on one syntax, then that goal cannot be met. 

I would LOVE it if there were a 'standardized' preprocessor for haskell
that worked across language implementations. it would make life so much

A haskell specific feature I thought would be really cool would be the
ability to say available(Control.Monad.State) which would evaluate to
true if the Control.Monad.State library were available. 


John Meacham - ⑆⑆john⑈ 

More information about the Libraries mailing list