on master help sign in
Extra check in parseInteger
5ddb7a3Dmitry Nikulin
libs/base/Data/String.idr+3−1
@@ -49,7 +49,9 @@ parseInteger s = parseIntTrimmed (trim s)
49 then map (\y => negate (fromInteger y)) (parseNumWithoutSign (unpack xs) 0)
49 then map (\y => negate (fromInteger y)) (parseNumWithoutSign (unpack xs) 0)
50 else if (x == '+')
50 else if (x == '+')
51 then map fromInteger (parseNumWithoutSign (unpack xs) (cast {from=Int} 0))
51 then map fromInteger (parseNumWithoutSign (unpack xs) (cast {from=Int} 0))
52+ else if (x >= '0' && x <= '9')
52− else map fromInteger (parseNumWithoutSign (unpack xs) (cast (ord x - ord '0')))
53+ then map fromInteger (parseNumWithoutSign (unpack xs) (cast (ord x - ord '0')))
54+ else Nothing
53
55
54
56
55||| Convert a number string to a Double.
57||| Convert a number string to a Double.