summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Utility/HumanTime.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/Utility/HumanTime.hs b/Utility/HumanTime.hs
index c55c862ca..644e6fbab 100644
--- a/Utility/HumanTime.hs
+++ b/Utility/HumanTime.hs
@@ -35,9 +35,11 @@ parseDuration = Duration <$$> go 0
go n [] = return n
go n s = do
num <- readish s :: Maybe Integer
- let (c:rest) = dropWhile isDigit s
- u <- M.lookup c unitmap
- go (n + num * u) rest
+ case dropWhile isDigit s of
+ (c:rest) -> do
+ u <- M.lookup c unitmap
+ go (n + num * u) rest
+ _ -> return $ n + num
fromDuration :: Duration -> String
fromDuration Duration { durationSeconds = d }