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

Daniel Trstenjak daniel.trstenjak at gmail.com
Mon May 11 08:31:03 UTC 2015


Hi Wren,

> 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.)

I think even more beneficial than type checking all cases is the
easier support for any Haskell tooling operating with the Haskell source
if all cases are part of the AST.


Greetings,
Daniel


More information about the Libraries mailing list