Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Pretty printing utils.
- class Pretty a where
- data Text :: *
- (%) :: Text -> Text -> Text
- (%%) :: Text -> Text -> Text
- empty :: Text
- char :: Char -> Text
- string :: String -> Text
- text :: Text -> Text
- vcat :: [Text] -> Text
- vsep :: [Text] -> Text
- hcat :: [Text] -> Text
- hsep :: [Text] -> Text
- parens :: Text -> Text
- braces :: Text -> Text
- brackets :: Text -> Text
- angles :: Text -> Text
- indents :: Int -> [Text] -> Text
- padRc :: Int -> Char -> Text -> Text
- padR :: Int -> Text -> Text
- padLc :: Int -> Char -> Text -> Text
- padL :: Int -> Text -> Text
- pprEngDouble :: String -> Double -> Maybe Text
- pprEngInteger :: String -> Integer -> Maybe Text
Documentation
Pretty Char Source # | |
Pretty Int Source # | |
Pretty Integer Source # | |
Pretty String Source # | |
Pretty Text Source # | |
Pretty UTCTime Source # | |
Pretty Bytes Source # | |
Pretty Seconds Source # | |
Pretty Sized Source # | |
Pretty Used Source # | |
Pretty Timed Source # | |
Pretty BuildError Source # | |
Pretty Platform Source # | |
Pretty Environment Source # | |
Pretty a => Pretty (Range a) Source # | |
Pretty a => Pretty (Comparison a) Source # | |
A space efficient, packed, unboxed Unicode text type.
pprEngDouble :: String -> Double -> Maybe Text Source #
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 Text Source #
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).