pluralize 1.1 kilobytes etc
This commit is contained in:
parent
dcf74cf8a4
commit
b8da297c77
1 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue