summaryrefslogtreecommitdiff
path: root/lib/Postdelay/TimeSpec/Units.hs
diff options
context:
space:
mode:
authorGregor Kleen <aethoago@141.li>2017-02-15 19:04:57 +0100
committerGregor Kleen <aethoago@141.li>2017-02-15 19:04:57 +0100
commit127c1212d7704392363e3614f339627bf514cfcf (patch)
tree10e9a0a1f48ec8aef518c3c33a6e34a7043d9738 /lib/Postdelay/TimeSpec/Units.hs
parent5b09b096e38ed231b62df57736e87c989b481b5d (diff)
downloadpostdelay-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.hs4
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
62rational = combine <$> some digitChar <*> option [] (char '.' *> many digitChar) <?> "Decimal number" 62rational = 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
70timeUnit :: StringParser s m => m Time 68timeUnit :: StringParser s m => m Time
71timeUnit = label "Unit of time" . choice $ 69timeUnit = label "Unit of time" . choice $