Fwd: Generating valid Haskell code using the GHC API pretty printer

Niklas Broberg niklas.broberg at gmail.com
Thu Jul 23 06:50:47 EDT 2009

> I believe, Language.Haskell.Pretty can properly output haskell code (and
> the GHC API should be able to do so, too. Does the GHC API output tabs?)

Surely you mean Language.Haskell.Exts.Pretty, right? ;-)

The haskell-src-exts library does not (yet) support full
round-tripping source-to-source, so the generated output will be
different from what was read. But it will at least produce valid
output. Hopefully in a few months' time it will do the full
round-tripping as well, at least that's the plan.

In general, unless you actually want to use any other components of
the GHC API, e.g. evaluate your code, then I see no reason to use the
GHC API for source manipulation. haskell-src-exts simply does that
better (and definitely better than haskell-src). But I couldn't tell
if that's enough for the original poster's needs. :-)

[/shameless plug]



More information about the Glasgow-haskell-users mailing list