[Haskell-cafe] RFC: "Native -XCPP" Proposal

wren romano winterkoninkje at gmail.com
Fri May 8 22:20:25 UTC 2015

On Fri, May 8, 2015 at 12:12 PM, Dan Doel <dan.doel at gmail.com> wrote:
> vector generates a considerable amount of code using CPP macros.
> And with regard to other mails, I'm not too eager (personally) to port that
> to template Haskell, even though I'm no fan of CPP. The code generation
> being done is so dumb that CPP is pretty much perfect for it, and TH would
> probably just be more work (and it's certainly more work to write it again
> now that it's already written).

Incidentally, if we really want to pursue the "get rid of CPP by
building it into the GHC distro"...

In recent years there've been a number of papers on "variational
lambda-calculi"[1] which essentially serve to embed flag-based
preprocessor conditionals directly into the language itself. One major
benefit of this approach is that the compiler can then typecheck *all*
variations of the code, rather than only checking whichever particular
variation we happen to be compiling at the time. This is extremely
useful for avoiding bitrot in the preprocessor conditionals.

...If we were to try and obviate the dependency on CPP, variational
typing seems like a far more solid approach than simply reinventing
the preprocessing wheel yet again. (The downside, of course, is making
the Haskell spec significantly more complex.)

[1] e.g., <http://dl.acm.org/citation.cfm?doid=2398856.2364535>

Live well,

More information about the Libraries mailing list