pretty newby

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Tue Sep 23 16:19:22 EDT 2003


Luc Taesch <list at taesch.com> writes:

> are there any facility to pretty print an haskell program ?
> im aware of HPJ combinators library, but i was looking for a command line
> utility, rather.. am i missing an entry in HPJ ?

To some extent, you can use an ordinary Haskell compiler to
pretty-print your Haskell code.  For instance, among the various
debugging options in nhc98, the compiler has the option
    +CTS -parse -CTS
to show the abstract syntax tree of a module immediately after parsing it.
(Other options show the syntax tree at other stages of the compilation,
such as after desugaring of field-syntax, type-checking, etc.)
I'm sure that ghc must have something similar.

In nhc98 there are also various options to control the 'look' of the
output of the pretty-printer, e.g.
    -showqualified
    -noshowqualified
    -showwidth=80
    -showident=4

Regards,
    Malcolm


More information about the Haskell mailing list