Pretty printing (was: Standard Library for text formatting?)
Jan Kort
kort@science.uva.nl
Mon, 26 Aug 2002 15:41:53 +0200
Dr Mark H Phillips wrote:
>
> Hi again,
>
> After doing some searching, it seems that "pretty printing" is
> a prominant "Haskell way" of doing text output. I still am
> interested in finding a library of standard text formatting
> (String formatting) functions, but it seems like it might
> be worth my while investigating pretty printing.
Pretty printing is not very suited for printf like formatting,
left/right justifying text is easy though:
-- left/right justify the string "xs" in a fieldwidth "n".
leftJustify n xs = xs ++ replicate (n - length xs) ' '
rightJustify n xs = replicate (n - length xs) ' ' ++ xs
Jan