parse "5" as 5 seconds
This commit is contained in:
parent
323fb55a31
commit
4830c0d830
1 changed files with 5 additions and 3 deletions
|
@ -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 }
|
||||
|
|
Loading…
Reference in a new issue