class ??? with Haddock

Wolfgang Jeltsch wolfgang at jeltsch.net
Thu Jan 8 17:53:43 EST 2004


Am Donnerstag, 8. Januar 2004 17:39 schrieb Simon Marlow:
> [...]

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

I found the problem, meanwhile.  You have to put the #ifdefs etc. at the 
beginning of the line.  Uuh—terrible, I'd say.  The same holds for cpp 
-traditional.  cpp without -traditional is more tolerant but treats 
everything beginning with // as a comment and is therefore not usable with 
Hugs when you need Data.Array.

Generally, I'd say that using a C preprocessor for Haskell is a bad idea but, 
of course, I can imagine that it requires less work to make cpp usable for 
Haskell than to develop a new preprocessor from scratch.  But is using cpp 
planned to be a long-term solution?

> Cheers,
> 	Simon

Wolfgang



More information about the Haskell mailing list