packages feed

formatting 6.2.1 → 6.2.2

raw patch · 3 files changed

+17/−11 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Formatting.Formatters: bytesDecimal :: (Ord f, Integral a, Fractional f) => Format Builder (f -> Builder) -> Format r (a -> r)
+ Formatting.Formatters: bytes :: (Ord f, Integral a, Fractional f) => Format Builder (f -> Builder) -> Format r (a -> r)

Files

formatting.cabal view
@@ -1,5 +1,5 @@ name:                formatting-version:             6.2.1+version:             6.2.2 synopsis:            Combinator-based type-safe formatting (like printf() or FORMAT) description:         Combinator-based type-safe formatting (like printf() or FORMAT), modelled from the HoleyMonoids package. license:             BSD3
src/Formatting.hs view
@@ -40,3 +40,4 @@  import Formatting.Formatters import Formatting.Internal+
src/Formatting/Formatters.hs view
@@ -51,7 +51,7 @@   prefixBin,   prefixOct,   prefixHex,-  bytesDecimal,+  bytes,   -- * Buildables   build,   Buildable,@@ -287,16 +287,20 @@   | i >= 10 && i < 36 = chr (ord 'a' + i - 10)   | otherwise = error ("intToDigit': Invalid int " ++ show i) --- | Renders a given byte count using an appropiate decimal binary suffix, e.g. MiB+-- | Renders a given byte count using an appropiate decimal binary suffix: ----- >>> sformat (bytes (fixed 2)) 424242--- "414.30 KiB"-bytesDecimal :: (Ord f,Integral a,Fractional f)-             => Format Builder (f -> Builder) -- ^ formatter for the decimal part-             -> Format r (a -> r)-bytesDecimal d = later go+-- >>> format (bytes shortest) 1024+-- "1KB"+--+-- >>> format (bytes (fixed 2 % " ")) (1024*1024*5)+-- "5.00 MB"+--+bytes :: (Ord f,Integral a,Fractional f)+      => Format Builder (f -> Builder) -- ^ formatter for the decimal part+      -> Format r (a -> r)+bytes d = later go   where go bs =-          bprint d (fromIntegral (signum bs) * dec) <> " " <> bytesSuffixes !!+          bprint d (fromIntegral (signum bs) * dec) <> bytesSuffixes !!           i           where (dec,i) = getSuffix (abs bs)         getSuffix n =@@ -306,4 +310,5 @@           where p (n',numDivs) =                   n' < 1024 || numDivs == (length bytesSuffixes - 1)         bytesSuffixes =-          ["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]+          ["B","KB","MB","GB","TB","PB","EB","ZB","YB"]+