[Haskell-cafe] Re: haddock could be a pretty-printer?

David Waern david.waern at gmail.com
Sat May 23 19:32:57 EDT 2009


2009/5/22 Maurício <briqueabraque at yahoo.com>:
>>> 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


More information about the Haskell-Cafe mailing list