@@ -37,10 +37,11 @@ import Data.Text.Encoding (decodeUtf8With)
3737import Data.Text.Encoding.Error (lenientDecode)
3838import qualified Data.HashMap.Strict as M
3939import Data.Typeable
40−import Data.Text.Read
4140#if MIN_VERSION_aeson(0, 7, 0)
42−import Data.Scientific (fromFloatDigits)
41+import qualified Data.Attoparsec.Text as Atto
42+import Data.Scientific (Scientific)
4343#else
44+import Data.Text.Read
4445import Data.Attoparsec.Number
4546#endif
4647import Control.Monad.Trans.Resource (ResourceT, runResourceT)
@@ -162,8 +163,7 @@ textToValue _ _ t
162163 | any (t `isLike`) ["y", "yes", "on", "true"] = Bool True
163164 | any (t `isLike`) ["n", "no", "off", "false"] = Bool False
164165#if MIN_VERSION_aeson(0, 7, 0)
165− | Right (x, "") <- signed decimal t = Number $ fromIntegral (x :: Integer)
166− | Right (x, "") <- double t = Number $ fromFloatDigits x
166+ | Right x <- textToScientific t = Number x
167167#else
168168 | Right (x, "") <- signed decimal t = Number $ I x
169169 | Right (x, "") <- double t = Number $ D x
@@ -172,6 +172,10 @@ textToValue _ _ t
172172 where x `isLike` ref = x `elem` [ref, T.toUpper ref, titleCased]
173173 where titleCased = toUpper (T.head ref) `T.cons` T.tail ref
174174
175+#if MIN_VERSION_aeson(0, 7, 0)
176+textToScientific :: Text -> Either String Scientific
177+textToScientific = Atto.parseOnly (Atto.scientific <* Atto.endOfInput)
178+#endif
175179
176180parseO :: C.Sink Event Parse Value
177181parseO = do