class ??? with Haddock

Simon Marlow simonmar at microsoft.com
Thu Jan 8 16:44:11 EST 2004


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


More information about the Haskell mailing list