on master help sign in
Merge pull request #567 from phadej/export-jsstring-scientific
5fd9078Adam Bergmark
Data/Aeson/Parser.hs+2−1
@@ -33,6 +33,7 @@ module Data.Aeson.Parser
33 json
33 json
34 , value
34 , value
35 , jstring
35 , jstring
36+ , scientific
36 -- * Strict parsers
37 -- * Strict parsers
37 -- $strict
38 -- $strict
38 , json'
39 , json'
@@ -46,7 +47,7 @@ module Data.Aeson.Parser
46
47
47import Prelude ()
48import Prelude ()
48
49
49−import Data.Aeson.Parser.Internal (decodeStrictWith, decodeWith, eitherDecodeStrictWith, eitherDecodeWith, json, json', jstring, value, value')
50+import Data.Aeson.Parser.Internal (decodeStrictWith, decodeWith, eitherDecodeStrictWith, eitherDecodeWith, json, json', jstring, scientific, value, value')
50
51
51-- $lazy
52-- $lazy
52--
53--
Data/Aeson/Parser/Internal.hs+4−1
@@ -23,6 +23,8 @@ module Data.Aeson.Parser.Internal
23 json, jsonEOF
23 json, jsonEOF
24 , value
24 , value
25 , jstring
25 , jstring
26+ , jstring_
27+ , scientific
26 -- * Strict parsers
28 -- * Strict parsers
27 , json', jsonEOF'
29 , json', jsonEOF'
28 , value'
30 , value'
@@ -334,7 +336,7 @@ decimal0 = do
334 then fail "leading zero"
336 then fail "leading zero"
335 else return (B.foldl' step 0 digits)
337 else return (B.foldl' step 0 digits)
336
338
337−{-# INLINE scientific #-}
339+-- | Parse a JSON number.
338scientific :: Parser Scientific
340scientific :: Parser Scientific
339scientific = do
341scientific = do
340 let minus = 45
342 let minus = 45
@@ -364,3 +366,4 @@ scientific = do
364 (A.satisfy (\ex -> ex == littleE || ex == bigE) *>
366 (A.satisfy (\ex -> ex == littleE || ex == bigE) *>
365 fmap (Sci.scientific signedCoeff . (e +)) (signed decimal)) <|>
367 fmap (Sci.scientific signedCoeff . (e +)) (signed decimal)) <|>
366 return (Sci.scientific signedCoeff e)
368 return (Sci.scientific signedCoeff e)
369+{-# INLINE scientific #-}
aeson.cabal+1−1
@@ -93,6 +93,7 @@ library
93 Data.Aeson.Encoding.Internal
93 Data.Aeson.Encoding.Internal
94 Data.Aeson.Internal
94 Data.Aeson.Internal
95 Data.Aeson.Internal.Time
95 Data.Aeson.Internal.Time
96+ Data.Aeson.Parser.Internal
96
97
97 -- Deprecated modules
98 -- Deprecated modules
98 exposed-modules:
99 exposed-modules:
@@ -101,7 +102,6 @@ library
101 other-modules:
102 other-modules:
102 Data.Aeson.Encoding.Builder
103 Data.Aeson.Encoding.Builder
103 Data.Aeson.Internal.Functions
104 Data.Aeson.Internal.Functions
104− Data.Aeson.Parser.Internal
105 Data.Aeson.Parser.Unescape
105 Data.Aeson.Parser.Unescape
106 Data.Aeson.Parser.Time
106 Data.Aeson.Parser.Time
107 Data.Aeson.Types.FromJSON
107 Data.Aeson.Types.FromJSON