[Haskell-beginners] Haskell Preprocessor?

Mike Sullivan mbsullivan at gmail.com
Wed Sep 24 21:57:45 EDT 2008


Hi All,

What is the easiest and/or best way to define global "constants" in Haskell
(avoiding any side effects, of course). The functionality I'm thinking of is
similar to the use of global "const" variables or #defines in C code.

Judging from this article (
http://www.lochan.org/keith/publications/hspp-hw99.ps.gz) and the existence
of the GHC -cpp command-line option, it seems that it is possible to use the
C preprocessor on Haskell code. However, the article is fairly old ('99)...
Is this still (or was it ever) the best way? The point of the article is
that it's not... were any of the "Haskell preprocessor" suggestions in the
paper (dubbed "HsPP") adopted by GHC, and can we use them?

There also seems to be a (almost fully) native implementation of a Haskell
preprocessor in Hackage (
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/cpphs). Does
anybody use it?

What would you use if you wanted such functionality?

Thanks!
Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20080924/25c0e1e3/attachment.htm


More information about the Beginners mailing list