tweak
This commit is contained in:
parent
fd8cba164c
commit
849c183f23
1 changed files with 3 additions and 3 deletions
|
@ -11,6 +11,7 @@ module DataUnits (
|
||||||
memoryUnits,
|
memoryUnits,
|
||||||
bandwidthUnits,
|
bandwidthUnits,
|
||||||
oldSchoolUnits,
|
oldSchoolUnits,
|
||||||
|
|
||||||
roughSize,
|
roughSize,
|
||||||
compareSizes,
|
compareSizes,
|
||||||
readSize
|
readSize
|
||||||
|
@ -142,11 +143,10 @@ readSize units input
|
||||||
where
|
where
|
||||||
(number, rest) = head parsednum
|
(number, rest) = head parsednum
|
||||||
multiplier = head $ parsedunit
|
multiplier = head $ parsedunit
|
||||||
|
unitname = takeWhile isAlpha $ dropWhile isSpace rest
|
||||||
|
|
||||||
parsednum = reads input :: [(Double, String)]
|
parsednum = reads input :: [(Double, String)]
|
||||||
parsedunit = lookupUnit units unit
|
parsedunit = lookupUnit units unitname
|
||||||
|
|
||||||
unit = takeWhile isAlpha $ dropWhile isSpace rest
|
|
||||||
|
|
||||||
lookupUnit _ [] = [1] -- no unit given, assume bytes
|
lookupUnit _ [] = [1] -- no unit given, assume bytes
|
||||||
lookupUnit [] _ = []
|
lookupUnit [] _ = []
|
||||||
|
|
Loading…
Reference in a new issue