adeiu, MissingH
Removed dependency on MissingH, instead depending on the split library. After laying groundwork for this since 2015, it was mostly straightforward. Added Utility.Tuple and Utility.Split. Eyeballed System.Path.WildMatch while implementing the same thing. Since MissingH's progress meter display was being used, I re-implemented my own. Bonus: Now progress is displayed for transfers of files of unknown size. This commit was sponsored by Shane-o on Patreon.
This commit is contained in:
parent
6dd806f1ad
commit
a1730cd6af
37 changed files with 230 additions and 101 deletions
|
@ -45,6 +45,7 @@ module Utility.DataUnits (
|
|||
ByteSize,
|
||||
|
||||
roughSize,
|
||||
roughSize',
|
||||
compareSizes,
|
||||
readSize
|
||||
) where
|
||||
|
@ -109,7 +110,10 @@ oldSchoolUnits = zipWith (curry mingle) storageUnits memoryUnits
|
|||
|
||||
{- approximate display of a particular number of bytes -}
|
||||
roughSize :: [Unit] -> Bool -> ByteSize -> String
|
||||
roughSize units short i
|
||||
roughSize units short i = roughSize' units short 2 i
|
||||
|
||||
roughSize' :: [Unit] -> Bool -> Int -> ByteSize -> String
|
||||
roughSize' units short precision i
|
||||
| i < 0 = '-' : findUnit units' (negate i)
|
||||
| otherwise = findUnit units' i
|
||||
where
|
||||
|
@ -123,7 +127,7 @@ roughSize units short i
|
|||
showUnit x (Unit size abbrev name) = s ++ " " ++ unit
|
||||
where
|
||||
v = (fromInteger x :: Double) / fromInteger size
|
||||
s = showImprecise 2 v
|
||||
s = showImprecise precision v
|
||||
unit
|
||||
| short = abbrev
|
||||
| s == "1" = name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue