From 127c1212d7704392363e3614f339627bf514cfcf Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 15 Feb 2017 19:04:57 +0100 Subject: Timezones --- lib/Postdelay/TimeSpec/Units.hs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/Postdelay/TimeSpec/Units.hs') diff --git a/lib/Postdelay/TimeSpec/Units.hs b/lib/Postdelay/TimeSpec/Units.hs index 0062460..a094ea3 100644 --- a/lib/Postdelay/TimeSpec/Units.hs +++ b/lib/Postdelay/TimeSpec/Units.hs @@ -62,10 +62,8 @@ rational :: forall s m n. (StringParser s m, Fractional n, Num n) => m n rational = combine <$> some digitChar <*> option [] (char '.' *> many digitChar) "Decimal number" where combine :: [Char] -> [Char] -> n - combine (map asN -> whole) (map asN -> fractional) + combine (map fromDigit -> whole) (map fromDigit -> fractional) = foldl' (\i l -> i * 10 + l) 0 whole + (foldr' (\h t -> h + t / 10) 0 fractional) / 10 - asN :: Char -> n - asN c = fromIntegral $ fromEnum c - fromEnum '0' timeUnit :: StringParser s m => m Time timeUnit = label "Unit of time" . choice $ -- cgit v1.2.3