diff options
author | Gregor Kleen <aethoago@141.li> | 2017-02-17 22:04:43 +0100 |
---|---|---|
committer | Gregor Kleen <aethoago@141.li> | 2017-02-17 22:04:43 +0100 |
commit | 479d66dd0b3c2b6919e626b1c3c3fea9b0c9df8a (patch) | |
tree | 815b6f987c15cfb0cd3322a7900762418d46fd06 /lib/Postdelay/TimeSpec | |
parent | d84405d3e923f4677103143f8b7cc22c9adb6443 (diff) | |
download | postdelay-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.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) |