summaryrefslogtreecommitdiff
path: root/lib/Postdelay/TimeSpec
diff options
context:
space:
mode:
authorGregor Kleen <aethoago@141.li>2017-02-17 22:04:43 +0100
committerGregor Kleen <aethoago@141.li>2017-02-17 22:04:43 +0100
commit479d66dd0b3c2b6919e626b1c3c3fea9b0c9df8a (patch)
tree815b6f987c15cfb0cd3322a7900762418d46fd06 /lib/Postdelay/TimeSpec
parentd84405d3e923f4677103143f8b7cc22c9adb6443 (diff)
downloadpostdelay-479d66dd0b3c2b6919e626b1c3c3fea9b0c9df8a.tar
postdelay-479d66dd0b3c2b6919e626b1c3c3fea9b0c9df8a.tar.gz
postdelay-479d66dd0b3c2b6919e626b1c3c3fea9b0c9df8a.tar.bz2
postdelay-479d66dd0b3c2b6919e626b1c3c3fea9b0c9df8a.tar.xz
postdelay-479d66dd0b3c2b6919e626b1c3c3fea9b0c9df8a.zip
Prioritised endomorphisms
Diffstat (limited to 'lib/Postdelay/TimeSpec')
-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)