on master help sign in
Parse a number using the new scientific parser
03e44ddBas van Dijk
Data/Aeson/Parser/Internal.hs+3−3
@@ -43,7 +43,7 @@ import Data.ByteString.Lazy.Builder
43
43
44import Control.Applicative ((*>), (<$>), (<*), liftA2, pure)
44import Control.Applicative ((*>), (<$>), (<*), liftA2, pure)
45import Data.Aeson.Types (Result(..), Value(..))
45import Data.Aeson.Types (Result(..), Value(..))
46−import Data.Attoparsec.Char8 (Parser, char, endOfInput, rational,
46+import Data.Attoparsec.Char8 (Parser, char, endOfInput, scientific,
47 skipSpace, string)
47 skipSpace, string)
48import Data.Bits ((.|.), shiftL)
48import Data.Bits ((.|.), shiftL)
49import Data.ByteString (ByteString)
49import Data.ByteString (ByteString)
@@ -173,7 +173,7 @@ value = do
173 C_t -> string "true" *> pure (Bool True)
173 C_t -> string "true" *> pure (Bool True)
174 C_n -> string "null" *> pure Null
174 C_n -> string "null" *> pure Null
175 _ | w >= 48 && w <= 57 || w == 45
175 _ | w >= 48 && w <= 57 || w == 45
176− -> Number <$> rational
176+ -> Number <$> scientific
177 | otherwise -> fail "not a valid json value"
177 | otherwise -> fail "not a valid json value"
178
178
179-- | Strict version of 'value'. See also 'json''.
179-- | Strict version of 'value'. See also 'json''.
@@ -191,7 +191,7 @@ value' = do
191 C_n -> string "null" *> pure Null
191 C_n -> string "null" *> pure Null
192 _ | w >= 48 && w <= 57 || w == 45
192 _ | w >= 48 && w <= 57 || w == 45
193 -> do
193 -> do
194− !n <- rational
194+ !n <- scientific
195 return (Number n)
195 return (Number n)
196 | otherwise -> fail "not a valid json value"
196 | otherwise -> fail "not a valid json value"
197
197
aeson.cabal+1−1
@@ -113,7 +113,7 @@ library
113 Data.Aeson.Types.Generic
113 Data.Aeson.Types.Generic
114
114
115 build-depends:
115 build-depends:
116− attoparsec >= 0.10.2.1,
116+ attoparsec >= 0.11.3.0,
117 base == 4.*,
117 base == 4.*,
118 containers,
118 containers,
119 deepseq,
119 deepseq,