diff options
author | Gregor Kleen <aethoago@141.li> | 2017-02-15 19:04:57 +0100 |
---|---|---|
committer | Gregor Kleen <aethoago@141.li> | 2017-02-15 19:04:57 +0100 |
commit | 127c1212d7704392363e3614f339627bf514cfcf (patch) | |
tree | 10e9a0a1f48ec8aef518c3c33a6e34a7043d9738 /lib/Postdelay/TimeSpec/Units.hs | |
parent | 5b09b096e38ed231b62df57736e87c989b481b5d (diff) | |
download | postdelay-127c1212d7704392363e3614f339627bf514cfcf.tar postdelay-127c1212d7704392363e3614f339627bf514cfcf.tar.gz postdelay-127c1212d7704392363e3614f339627bf514cfcf.tar.bz2 postdelay-127c1212d7704392363e3614f339627bf514cfcf.tar.xz postdelay-127c1212d7704392363e3614f339627bf514cfcf.zip |
Timezones
Diffstat (limited to 'lib/Postdelay/TimeSpec/Units.hs')
-rw-r--r-- | lib/Postdelay/TimeSpec/Units.hs | 4 |
1 files changed, 1 insertions, 3 deletions
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 | |||
62 | rational = combine <$> some digitChar <*> option [] (char '.' *> many digitChar) <?> "Decimal number" | 62 | rational = combine <$> some digitChar <*> option [] (char '.' *> many digitChar) <?> "Decimal number" |
63 | where | 63 | where |
64 | combine :: [Char] -> [Char] -> n | 64 | combine :: [Char] -> [Char] -> n |
65 | combine (map asN -> whole) (map asN -> fractional) | 65 | combine (map fromDigit -> whole) (map fromDigit -> fractional) |
66 | = foldl' (\i l -> i * 10 + l) 0 whole + (foldr' (\h t -> h + t / 10) 0 fractional) / 10 | 66 | = foldl' (\i l -> i * 10 + l) 0 whole + (foldr' (\h t -> h + t / 10) 0 fractional) / 10 |
67 | asN :: Char -> n | ||
68 | asN c = fromIntegral $ fromEnum c - fromEnum '0' | ||
69 | 67 | ||
70 | timeUnit :: StringParser s m => m Time | 68 | timeUnit :: StringParser s m => m Time |
71 | timeUnit = label "Unit of time" . choice $ | 69 | timeUnit = label "Unit of time" . choice $ |