Am Donnerstag, 8. Januar 2004 11:02 schrieben Sie:
[...]
Anyway, you can use GHC to preprocess your source files before feeding them to Haddock:
$ ghc -E -cpp -D__HADDOCK__ Foo.hs -o Foo.raw-hs
This only replaces all __HADDOCK__ occurences with 1 but doesn't process #ifdefs.
Are you sure? It works for me, and it's what we use in GHC's libraries.
One thing I forgot to mention is that you also need to remove the pesky lines beginning with '#' that the C preprocessor leaves behind. Here's what we do in GHC: $ ghc -D__HADDOCK__ -E -cpp Foo.hs -o Foo.tmp $ sed -e 's/^#.*//' <Foo.tmp >Foo.raw-hs Cheers, Simon
Am Donnerstag, 8. Januar 2004 17:44 schrieb Simon Marlow:
[...]
One thing I forgot to mention is that you also need to remove the pesky lines beginning with '#' that the C preprocessor leaves behind. Here's what we do in GHC:
$ ghc -D__HADDOCK__ -E -cpp Foo.hs -o Foo.tmp $ sed -e 's/^#.*//' <Foo.tmp >Foo.raw-hs
I use cpp with option -P to solve this problem.
Cheers, Simon
Wolfgang
participants (2)
-
Simon Marlow -
Wolfgang Jeltsch