Pretty Printing Libraray Question

Jens Petersen juhp@01.246.ne.jp
15 Jul 2002 12:32:41 +0900


Yu Di <diyu60607@yahoo.com> writes:

> Hi, I am using the ghc-5.04 module
> Text.Pretty.HughesPJ (originally "Pretty" in the
> "text" package) to do some formatting. It works great,
> but has one small problem: the output always uses tab
> for 8 spaces. For example:
> 
> d = text "abc" $+$ nest 8 (text "bcd") $+$ text "cde"
> s = render d
> 
> will have a tab before "bcd", not 8 spaces. I have
> tested this on both Solaris 2.8 and Linux.
> 
> Is there a way to change this behavior and make it use
> spaces always? I looked at the code but cannot find
> related information.

Btw what's wrong with the tab?  I guess you can always
convert the tabs ('\t') to spaces after pretty printting...

The tab seems to come from:

indent n | n >= 8 = '\t' : indent (n - 8)
         | otherwise      = spaces n

Hth, Jens