summaryrefslogtreecommitdiff
path: root/Utility/DataUnits.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-07-19 14:05:27 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-07-19 14:05:27 -0400
commit1df5db7e48a4fed941dfaa975f7242e48d53a707 (patch)
tree0fb1a40c9c2a8a3e1f8edb7cd12b56cbe730d0df /Utility/DataUnits.hs
parentb28dcf46c6fa304c622e4ffd3e84f426a8b08f48 (diff)
pluralize 1.1 kilobytes etc
Diffstat (limited to 'Utility/DataUnits.hs')
-rw-r--r--Utility/DataUnits.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/Utility/DataUnits.hs b/Utility/DataUnits.hs
index e5c2fc83e..511b3be80 100644
--- a/Utility/DataUnits.hs
+++ b/Utility/DataUnits.hs
@@ -118,7 +118,7 @@ roughSize units abbrev i
showUnit i' (Unit s a n) = let (num, decimal) = chop i' s in
show num ++ decimal ++ " " ++
- (if abbrev then a else plural num n)
+ (if abbrev then a else plural num decimal n)
chop :: Integer -> Integer -> (Integer, String)
chop i' d =
@@ -130,9 +130,9 @@ roughSize units abbrev i
then (num, "")
else (num, "." ++ ds')
- plural n u
- | n == 1 = u
- | otherwise = u ++ "s"
+ plural num decimal n
+ | num == 1 && null decimal = n
+ | otherwise = n ++ "s"
{- displays comparison of two sizes -}
compareSizes :: [Unit] -> Bool -> ByteSize -> ByteSize -> String