<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
The GHC manual says that if you pass -cpp to GHC, it runs the C
preprocessor, "cpp" on your code before compilation
(<a class="moz-txt-link-freetext" href="http://www.haskell.org/ghc/docs/latest/html/users_guide/options-phases.html#c-pre-processor">http://www.haskell.org/ghc/docs/latest/html/users_guide/options-phases.html#c-pre-processor</a>). 
But why, in that case, does stringize not seem to work when the -cpp
flag is given?<br>
<br>
In my example, test.hs is using the C preprocessor with a simple macro
to trace functions with their name.  Running GHC with -cpp gives an
error, but if I run cpp on the file directly then feed it to GHC, I get
no error:<br>
<br>
=====<br>
<b>$ ghc --version</b><br>
The Glorious Glasgow Haskell Compilation System, version 6.10.3<br>
<br>
<br>
<b>$ cat test.hs</b><br>
import Debug.Trace<br>
<br>
#define TR(f) (trace #f f)<br>
<br>
main :: IO ()<br>
main = TR(putStrLn) "Hello!"<br>
<br>
<br>
<b>$ ghc -cpp --make test.hs</b><br>
[1 of 1] Compiling Main             ( test.hs, test.o )<br>
<br>
test.hs:6:14: Not in scope: `#'<br>
<br>
<br>
<b>$ cpp test.hs</b><br>
# 1 "test.hs"<br>
# 1 "&lt;built-in&gt;"<br>
# 1 "&lt;command-line&gt;"<br>
# 1 "test.hs"<br>
import Debug.Trace<br>
<br>
<br>
<br>
main :: IO ()<br>
main = (trace "putStrLn" putStrLn) "Hello!"<br>
<br>
<br>
<b>$ cpp test.hs &gt; test-cpp.hs</b><br>
<br>
<br>
<b>$ ghc -cpp --make test-cpp.hs</b><br>
[1 of 1] Compiling Main             ( test-cpp.hs, test-cpp.o )<br>
Linking test-cpp ...<br>
<br>
<br>
<b>$ ./test-cpp</b><br>
putStrLn<br>
Hello!<br>
<br>
<br>
=====<br>
<br>
What am I missing?<br>
<br>
Thanks,<br>
<br>
Neil.<br>
</body>
</html>