@@ -178,11 +178,11 @@ parseRealFloat _ Null = pure (0/0)
178178parseRealFloat expected v = typeMismatch expected v
179179{-# INLINE parseRealFloat #-}
180180
181−truncateIntegral :: Integral a => String -> Scientific -> Parser a
182−truncateIntegral expected s
183− | Scientific.isInteger s = pure (truncate s)
184− | otherwise =
185− fail $ "Floating number specified for " ++ expected ++ ": " ++ show s
181+truncateIntegral :: forall a. Integral a => String -> Scientific -> Parser a
182+truncateIntegral expected s =
183+ case Scientific.floatingOrInteger s :: Either Double a of
184+ Right x -> pure x
185+ Left _ -> fail $ "Floating number specified for " ++ expected ++ ": " ++ show s
186186{-# INLINE truncateIntegral #-}
187187
188188parseIntegral :: Integral a => String -> Value -> Parser a