text-format 0.3.0.3 → 0.3.0.4
raw patch · 2 files changed
+13/−5 lines, 2 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Data.Text.Format: shortest :: Real a => a -> Builder
Files
- Data/Text/Format.hs +12/−4
- text-format.cabal +1/−1
Data/Text/Format.hs view
@@ -32,6 +32,7 @@ , expt , fixed , prec+ , shortest ) where import Control.Monad.IO.Class (MonadIO(liftIO))@@ -101,7 +102,7 @@ right k c = fromLazyText . LT.justifyLeft (fromIntegral k) c . toLazyText . B.build --- ^ Render a floating point number, with the given number of digits+-- | Render a floating point number, with the given number of digits -- of precision. Uses decimal notation for values between @0.1@ and -- @9,999,999@, and scientific notation otherwise. prec :: (Real a) =>@@ -112,7 +113,7 @@ forall d x. prec d (x::Double) = B.build (C.toPrecision d x) #-} prec digits = B.build . C.toPrecision digits . realToFrac --- ^ Render a floating point number using normal notation, with the+-- | Render a floating point number using normal notation, with the -- given number of decimal places. fixed :: (Real a) => Int@@ -122,7 +123,7 @@ {-# RULES "fixed/Double" forall d x. fixed d (x::Double) = B.build (C.toFixed d x) #-} --- ^ Render a floating point number using scientific/engineering+-- | Render a floating point number using scientific/engineering -- notation (e.g. @2.3e123@), with the given number of decimal places. expt :: (Real a) => Int@@ -132,7 +133,14 @@ {-# RULES "expt/Double" forall d x. expt d (x::Double) = B.build (C.toExponential d x) #-} --- ^ Render an integer using hexadecimal notation. (No leading "0x"+-- | Render a floating point number using the smallest number of+-- digits that correctly represent it.+shortest :: (Real a) => a -> Builder+shortest = B.build . C.toShortest . realToFrac+{-# RULES "shortest/Double"+ forall x. shortest (x::Double) = B.build (C.toShortest x) #-}++-- | Render an integer using hexadecimal notation. (No leading "0x" -- is added.) hex :: Integral a => a -> Builder hex = B.build . Hex
text-format.cabal view
@@ -1,5 +1,5 @@ name: text-format-version: 0.3.0.3+version: 0.3.0.4 license: BSD3 license-file: LICENSE homepage: https://github.com/mailrank/text-format