From 479d66dd0b3c2b6919e626b1c3c3fea9b0c9df8a Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 17 Feb 2017 22:04:43 +0100 Subject: Prioritised endomorphisms --- lib/Postdelay/TimeSpec/Utils.hs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/Postdelay/TimeSpec/Utils.hs') 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 import Text.Megaparsec.Prim (MonadParsec) import qualified Text.Megaparsec.Lexer as L +import Debug.Trace + type StringParser s m = (MonadParsec Dec s m, Token s ~ Char) @@ -86,6 +88,7 @@ boundedNatural padded (I.intersection (0 <=..< PosInf) -> bounds) = do | otherwise = int digits :: n -> Int + digits 0 = 1 digits n = succ . fromJust $ findIndex (\(min, max) -> min <= n && n < max) [ (10^i, 10^(succ i)) | i <- ([0..] :: [Int]) ] boundedRational :: forall s m n. (Show n, RealFrac n, StringParser s m) -- cgit v1.2.3