diff options
Diffstat (limited to 'lib/Postdelay/TimeSpec/Utils.hs')
-rw-r--r-- | lib/Postdelay/TimeSpec/Utils.hs | 3 |
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 | |||
35 | import Text.Megaparsec.Prim (MonadParsec) | 35 | import Text.Megaparsec.Prim (MonadParsec) |
36 | import qualified Text.Megaparsec.Lexer as L | 36 | import qualified Text.Megaparsec.Lexer as L |
37 | 37 | ||
38 | import Debug.Trace | ||
39 | |||
38 | 40 | ||
39 | type StringParser s m = (MonadParsec Dec s m, Token s ~ Char) | 41 | type 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 | ||
91 | boundedRational :: forall s m n. (Show n, RealFrac n, StringParser s m) | 94 | boundedRational :: forall s m n. (Show n, RealFrac n, StringParser s m) |