Pretty printing utils.
Documentation
module Text.PrettyPrint
Pretty Float | |
Pretty Int | |
Pretty Integer | |
Pretty String | |
Pretty Doc | |
Pretty UTCTime | |
Pretty Sized | |
Pretty Used | |
Pretty Timed | |
Pretty Bytes | |
Pretty Seconds | |
Pretty Quirk | |
Pretty BuildError | |
Pretty Platform | |
Pretty Environment | |
Pretty BuildResults | |
Pretty a => Pretty [a] | |
Pretty a => Pretty (Stats a) | |
Pretty a => Pretty (Single a) | |
(Pretty (t Bytes), Pretty (t Seconds)) => Pretty (WithUnits t) | |
Pretty a => Pretty (StatsComparison a) | |
Pretty a => Pretty (Comparison a) | |
(Pretty (c Seconds), Pretty (c Bytes)) => Pretty (BenchRunResult c) | |
(Pretty (c Seconds), Pretty (c Bytes)) => Pretty (BenchResult c) | |
(Pretty (c Seconds), Pretty (c Bytes)) => Pretty (Aspect c units) |
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).