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 ? thanks Luc
Luc Taesch <list@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
On Tuesday 23 September 2003 16.05, Luc Taesch wrote:
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 ?
thanks Luc _______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
Hi, In GHC (and HUGS?) you can use the 'haskell-src' package which contains functions for parsing and pretty-printing haskell code. Using these, it only takes a couple of lines to make your own command line, pretty-printer for haskell code. If you want to, you can use my implementation which I attach to this mail. The problem with the parser, however, is that it doesn't handle comments at all. Regards Per
participants (4)
-
Luc Taesch -
Malcolm Wallace -
Nick Name -
Per Larsson