
I'm of a mind to fix two things in cabal: - the haddock command runs unlit first, THEN cpp - the unlit module preserves comments, for the benefit of haddock
Sounds great. Send your patches to cabal-devel@haskell.org. You may also like to subscribe to that mailing list.
Have subscribed. Also, have a question about Cabal's unlit. I intend to change it's behaviour slightly, so that lines that are not completely empty (e.g. a single space) are treated as comment lines, rather than blanks. This makes it possible to write Haddock sections that contain paragraphs e.g. Bullet list: <space> * bullet 1 <space> * bullet 2 becomes -- Bullet list: -- -- * bullet 1 -- -- * bullet 2 which is what Haddock requires to render a bullet list. This change might break programs that have otherwise blank lines containing spaces next to program lines. However, given that (AFAICT) unlit is only used in generating Haddock docs, and this is currently broken anyway for .lhs files, this doesn't seem like much of a concern. Another possibility is to also relax (well, disable) the "program-line-next-to-comment-line" test in unlit. Again, we're only generating Haddock docs, so no major loss there. And this would permit programs that have blank-lines-with-spaces next to program lines. Alistair