haddock could be a pretty-printer?

Hi, The new version of haddock makes use of GHC parser. How much of effort would take to make haddock generate pretty-print of the source code itself, including haddock documentation (although probably loosing other comments)? Maybe even an html version that documentation could point to? Thanks, Maurício

2009/5/22 Maurício
Hi,
The new version of haddock makes use of GHC parser. How much of effort would take to make haddock generate pretty-print of the source code itself, including haddock documentation (although probably loosing other comments)? Maybe even an html version that documentation could point to?
You can use hscolour to output source code in HTML form and Haddock can generate links to it if you use the --source-* flags. Most documentation on Hackage seems to make use of this. Is this what you want or is there some reason why you want the code to be pretty-printed? David

The new version of haddock makes use of GHC parser. How much of effort would take to make haddock generate pretty-print of the source code itself, (...)
(...) Is this what you want or is there some reason why you want the code to be pretty-printed?
I usually have to resort to braces or bad indenting to get code to parse, but I like to give it good presentation before publishing. I used to pretty-print my code using haskell-src-exts with great result, but that kills documentation. Best, Maurício

2009/5/22 Maurício
The new version of haddock makes use of GHC parser. How much of effort would take to make haddock generate pretty-print of the source code itself, (...)
(...) Is this what you want or is there some reason why you want the code to be pretty-printed?
I usually have to resort to braces or bad indenting to get code to parse, but I like to give it good presentation before publishing.
I used to pretty-print my code using haskell-src-exts with great result, but that kills documentation.
I think the plan is to extend haskell-src-exts to retain comments. But if you want something that works now, you could use the GHC API. It has support for getting the token stream of a module, which contains the comments as tokens. Using Haddock to do this is not a good idea, better use the GHC API directly. David
participants (2)
-
David Waern
-
Maurício