summaryrefslogtreecommitdiff
path: root/lib/Postdelay/TimeSpec/Utils.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Postdelay/TimeSpec/Utils.hs')
-rw-r--r--lib/Postdelay/TimeSpec/Utils.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Postdelay/TimeSpec/Utils.hs b/lib/Postdelay/TimeSpec/Utils.hs
index 628a1d9..0bce51a 100644
--- a/lib/Postdelay/TimeSpec/Utils.hs
+++ b/lib/Postdelay/TimeSpec/Utils.hs
@@ -35,6 +35,8 @@ import Text.Megaparsec
35import Text.Megaparsec.Prim (MonadParsec) 35import Text.Megaparsec.Prim (MonadParsec)
36import qualified Text.Megaparsec.Lexer as L 36import qualified Text.Megaparsec.Lexer as L
37 37
38import Debug.Trace
39
38 40
39type StringParser s m = (MonadParsec Dec s m, Token s ~ Char) 41type StringParser s m = (MonadParsec Dec s m, Token s ~ Char)
40 42
@@ -86,6 +88,7 @@ boundedNatural padded (I.intersection (0 <=..< PosInf) -> bounds) = do
86 | otherwise = int 88 | otherwise = int
87 89
88 digits :: n -> Int 90 digits :: n -> Int
91 digits 0 = 1
89 digits n = succ . fromJust $ findIndex (\(min, max) -> min <= n && n < max) [ (10^i, 10^(succ i)) | i <- ([0..] :: [Int]) ] 92 digits n = succ . fromJust $ findIndex (\(min, max) -> min <= n && n < max) [ (10^i, 10^(succ i)) | i <- ([0..] :: [Int]) ]
90 93
91boundedRational :: forall s m n. (Show n, RealFrac n, StringParser s m) 94boundedRational :: forall s m n. (Show n, RealFrac n, StringParser s m)