@@ -37,10 +37,11 @@ import Data.Text.Encoding (decodeUtf8With)
37import Data.Text.Encoding.Error (lenientDecode)
37import Data.Text.Encoding.Error (lenientDecode)
38import qualified Data.HashMap.Strict as M
38import qualified Data.HashMap.Strict as M
39import Data.Typeable
39import Data.Typeable
41#if MIN_VERSION_aeson(0, 7, 0)
40#if MIN_VERSION_aeson(0, 7, 0)
41+import qualified Data.Attoparsec.Text as Atto
42−import Data.Scientific (fromFloatDigits)
42+import Data.Scientific (Scientific)
44import Data.Attoparsec.Number
45import Data.Attoparsec.Number
46import Control.Monad.Trans.Resource (ResourceT, runResourceT)
47import Control.Monad.Trans.Resource (ResourceT, runResourceT)
@@ -162,8 +163,7 @@ textToValue _ _ t
162 | any (t `isLike`) ["y", "yes", "on", "true"] = Bool True
163 | any (t `isLike`) ["y", "yes", "on", "true"] = Bool True
163 | any (t `isLike`) ["n", "no", "off", "false"] = Bool False
164 | any (t `isLike`) ["n", "no", "off", "false"] = Bool False
164#if MIN_VERSION_aeson(0, 7, 0)
165#if MIN_VERSION_aeson(0, 7, 0)
165− | Right (x, "") <- signed decimal t = Number $ fromIntegral (x :: Integer)
166+ | Right x <- textToScientific t = Number x
166− | Right (x, "") <- double t = Number $ fromFloatDigits x
168 | Right (x, "") <- signed decimal t = Number $ I x
168 | Right (x, "") <- signed decimal t = Number $ I x
169 | Right (x, "") <- double t = Number $ D x
169 | Right (x, "") <- double t = Number $ D x
@@ -172,6 +172,10 @@ textToValue _ _ t
172 where x `isLike` ref = x `elem` [ref, T.toUpper ref, titleCased]
172 where x `isLike` ref = x `elem` [ref, T.toUpper ref, titleCased]
173 where titleCased = toUpper (T.head ref) `T.cons` T.tail ref
173 where titleCased = toUpper (T.head ref) `T.cons` T.tail ref
175+#if MIN_VERSION_aeson(0, 7, 0)
176+textToScientific :: Text -> Either String Scientific
177+textToScientific = Atto.parseOnly (Atto.scientific <* Atto.endOfInput)
176parseO :: C.Sink Event Parse Value
180parseO :: C.Sink Event Parse Value
177parseO = do
181parseO = do