Hoogle Search
Within LTS Haskell 24.35 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
-
fakedata Faker.PhoneNumber No documentation available.
-
fakedata Faker.Quote No documentation available.
-
fakedata Faker.Sport.Volleyball No documentation available.
-
Formatting of doubles. This package provides support for number formatting styles, especially styles involving significant figure calculations.
Usage
>>> import Data.FormatN >>> comma (Just 3) 1234 1,230
format :: FormatStyle -> Maybe Int -> Double -> Textformatn Data.FormatN format a number according to a FormatStyle and significant figures
>>> format CommaStyle (Just 2) 1234 "1,200"
formatN :: FormatN -> Double -> Textformatn Data.FormatN run a FormatN
>>> formatN defaultFormatN 1234 "1,200"
formatNs :: FormatN -> [Double] -> [Text]formatn Data.FormatN Consistently format a list of numbers via using distinguish.
>>> formatNs defaultFormatN [0,1,1.01,1.02,1.1,1.2] ["0.00","1.00","1.01","1.02","1.10","1.20"]
formatOrShow :: FormatStyle -> Maybe Int -> Double -> Textformatn Data.FormatN Format with the shorter of show and a style.
>>> format (ExponentStyle Nothing) Nothing 0 "0e0" >>> formatOrShow (ExponentStyle Nothing) Nothing 0 "0"
formatSF :: FormatStyle -> SigFig -> Textformatn Data.FormatN format a SigFig according to a style
>>> formatSF CommaStyle (toSigFig (Just 2) 1234) "1,200" >>> formatSF CommaStyle (SigFig SigFigPos 0 1) "0" >>> formatSF CommaStyle (SigFig SigFigPos 0 (-1)) "0.0"
formats :: Bool -> Bool -> (Double -> FormatStyle) -> Maybe Int -> [Double] -> [Text]formatn Data.FormatN Consistently format a list of numbers,using the minimum number of decimal places or minimum exponent.
>>> formats True True precStyle (Just 1) [0,0.5,1,2] ["0.0","0.5","1.0","2.0"]
Note how the presence of 0.5 in the example above changes the format of all numbers. Without it:>>> formats True True precStyle (Just 1) [0,1,2] ["0","1","2"]
>>> formats False True precStyle (Just 1) $ ((-1)*) <$> [0,0.5,1,2] ["0.0","-0.5","-1.0","-2.0"] >>> formats True True commaPrecStyle (Just 1) $ ((-1000)*) <$> [0,0.5,1,2] [" 0"," -500","-1,000","-2,000"] >>> formats True True commaPrecStyle (Just 1) $ ((1e6)*) <$> [0,0.5,1,2] [" 0"," 500,000","1,000,000","2,000,000"] >>> formats True True commaPrecStyle (Just 1) $ ((1e6)*) <$> [0.9,2,3] ["0.9e6","2.0e6","3.0e6"] >>> formats True True commaPrecStyle (Just 1) $ ((1e-6)*) <$> [0,0.5,1,2] ["0.0e-6","0.5e-6","1.0e-6","2.0e-6"] >>> formats True True commaPrecStyle (Just 1) $ ((1e-3)*) <$> [0,0.5,1,2] ["0.0000","0.0005","0.0010","0.0020"] >>> formats True False (const (ExponentStyle Nothing)) (Just 2) [0..4] ["0.0e0","1.0e0","2.0e0","3.0e0","4.0e0"] >>> formats True True (const (ExponentStyle Nothing)) (Just 2) [0..4] ["0e0","1e0","2e0","3e0","4e0"]