@@ -80,12 +80,12 @@ import Data.Char (toUpper)
80import qualified Data.Vector as V
80import qualified Data.Vector as V
81import Data.Text (Text, pack)
81import Data.Text (Text, pack)
82import qualified Data.Text as T
82import qualified Data.Text as T
83−import Data.Text.Read (signed, decimal, double)
84import Data.Text.Encoding (encodeUtf8, decodeUtf8With)
83import Data.Text.Encoding (encodeUtf8, decodeUtf8With)
85import Data.Text.Encoding.Error (lenientDecode)
84import Data.Text.Encoding.Error (lenientDecode)
86import qualified Data.HashMap.Strict as M
85import qualified Data.HashMap.Strict as M
87import Data.Typeable
86import Data.Typeable
88−import Data.Attoparsec.Number
87+import Data.Attoparsec.ByteString (parseOnly)
88+import Data.Aeson.Parser (value)
89import qualified Data.HashSet as HashSet
89import qualified Data.HashSet as HashSet
91encode :: ToJSON a => a -> ByteString
91encode :: ToJSON a => a -> ByteString
@@ -210,8 +210,7 @@ textToValue _ _ t
210 | t `elem` ["null", "Null", "NULL", "~", ""] = Null
210 | t `elem` ["null", "Null", "NULL", "~", ""] = Null
211 | any (t `isLike`) ["y", "yes", "on", "true"] = Bool True
211 | any (t `isLike`) ["y", "yes", "on", "true"] = Bool True
212 | any (t `isLike`) ["n", "no", "off", "false"] = Bool False
212 | any (t `isLike`) ["n", "no", "off", "false"] = Bool False
213− | Right (x, "") <- signed decimal t = Number $ I x
213+ | Right (Number n) <- parseOnly value (encodeUtf8 t) = Number n
214− | Right (x, "") <- double t = Number $ D x
215 | otherwise = String t
214 | otherwise = String t
216 where x `isLike` ref = x `elem` [ref, T.toUpper ref, titleCased]
215 where x `isLike` ref = x `elem` [ref, T.toUpper ref, titleCased]
217 where titleCased = toUpper (T.head ref) `T.cons` T.tail ref
216 where titleCased = toUpper (T.head ref) `T.cons` T.tail ref