summaryrefslogtreecommitdiff
path: root/lib/Postdelay/TimeSpec/Units.hs
diff options
context:
space:
mode:
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 $