Template Haskell and the command line

George Russell ger at tzi.de
Tue Dec 2 16:31:30 EST 2003

Template Haskell is frightfully good and we want to get rid of cpp and
use it instead, but there's one tiny problem, namely that for cpp it
is possible to define variables on the command line (-DSIMON=MARLOW and so
on) while with Template Haskell it doesn't seem to be.  Could there be
some kind of dictionary, like the cpp environment variables, which the
Template Haskell code has access to?

One obvious way would be to accept the -D/-U arguments, and provide Haskell
functions which look at them.

Of course one /could/ presumably use System.getArgs and analyse the arguments
to ghc oneself, but that would mean making guesses about the current GHC syntax.

In the meantime we shall still replace cpp with Template Haskell, but find
another way.  Thanks for Template Haskell!

More information about the Glasgow-haskell-users mailing list