buildbox-2.1.2.3: Rehackable components for writing buildbots and test harnesses.

Safe HaskellNone

BuildBox.Pretty

Description

Pretty printing utils.

Synopsis

Documentation

padRc :: Int -> Char -> Doc -> DocSource

Right justify a doc, padding with a given character.

padR :: Int -> Doc -> DocSource

Right justify a string with spaces.

padLc :: Int -> Char -> Doc -> DocSource

Left justify a string, padding with a given character.

padL :: Int -> Doc -> DocSource

Left justify a string with spaces.

blank :: DocSource

Blank text. This is different different from empty because it comes out a a newline when used in a vcat.

pprEngDouble :: String -> Double -> Maybe DocSource

Pretty print an engineering value, to 4 significant figures. Valid range is 10^(-24) (y/yocto) to 10^(+24) (Y/Yotta). Out of range values yield Nothing.

examples:

   liftM render $ pprEngDouble "J" 102400    ==>   Just "1.024MJ"
   liftM render $ pprEngDouble "s" 0.0000123 ==>   Just "12.30us"

pprEngInteger :: String -> Integer -> Maybe DocSource

Like pprEngDouble but don't display fractional part when the value is < 1000. Good for units where fractional values might not make sense (like bytes).