-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Number text formatting. -- -- This package provides support for common number formatting patterns. -- --

Usage

-- --
--   import Data.FormatN
--   
-- -- See doctests for functionality and range. @package formatn @version 0.0.1 -- | Formatting of Doubles. module Data.FormatN -- | Wrapper for the various formatting options. -- --
--   >>> defaultFormatN
--   FormatComma 2
--   
data FormatN FormatFixed :: Int -> FormatN FormatDecimal :: Int -> FormatN FormatComma :: Int -> FormatN FormatExpt :: Int -> FormatN FormatPrec :: Int -> FormatN FormatDollar :: Int -> FormatN FormatPercent :: Int -> FormatN FormatNone :: FormatN -- | The official format defaultFormatN :: FormatN -- | type textifier fromFormatN :: IsString s => FormatN -> s -- | type readifier toFormatN :: (Eq s, IsString s) => s -> Int -> FormatN -- | to x decimal places -- --
--   >>> fixed 2 1
--   "1.00"
--   
-- --
--   >>> fixed 2 0.001
--   "0.00"
--   
fixed :: Int -> Double -> Text -- | round to n significant figures and always use decimal notation -- --
--   >>> decimal 2 0.000001234
--   "0.00000123"
--   
-- --
--   >>> decimal 2 1234567
--   "1230000"
--   
decimal :: Int -> Double -> Text -- | format numbers between 0.001 and 1,000,000 using digit and comma -- notation and exponential outside this range, with x significant -- figures. -- --
--   >>> prec 1 0.00234
--   "0.0023"
--   
-- --
--   >>> prec 1 0.000023
--   "2.3e-5"
--   
-- --
--   >>> prec 1 123
--   "120"
--   
-- --
--   >>> prec 1 123456
--   "120000"
--   
-- --
--   >>> prec 1 1234567
--   "1.2e6"
--   
prec :: Int -> Double -> Text -- | add commas format for numbers above 1,000 but below 1 million, -- otherwise use prec. -- --
--   >>> comma 2 1234
--   "1,230"
--   
comma :: Int -> Double -> Text -- | scientific exponential -- --
--   >>> expt 2 1234
--   "1.23e3"
--   
expt :: Int -> Double -> Text -- | dollars and cents, always decimal notation -- --
--   >>> dollar 2 1234
--   "$1,230"
--   
-- --
--   >>> dollar 2 0.01234
--   "$0.0123"
--   
dollar :: Int -> Double -> Text -- | make text formatN :: FormatN -> Double -> Text -- | Provide formatted text for a list of numbers so that they are just -- distinguished. 'precision commas 2 ticks' means use as much precision -- as is needed for them to be distinguished, but with at least 2 -- significant figures. precision :: (Int -> Double -> Text) -> Int -> [Double] -> [Text] -- | Consistently format a list of doubles. formatNs :: FormatN -> [Double] -> [Text] instance GHC.Generics.Generic Data.FormatN.FormatN instance GHC.Show.Show Data.FormatN.FormatN instance GHC.Classes.Eq Data.FormatN.FormatN