json-syntax 0.2.1.0 → 0.2.2.0
raw patch · 5 files changed
+21/−12 lines, 5 filesdep +containersdep +word-compatdep −unordered-containersdep ~aesondep ~scientific-notationPVP ok
version bump matches the API change (PVP)
Dependencies added: containers, word-compat
Dependencies removed: unordered-containers
Dependency ranges changed: aeson, scientific-notation
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- json-syntax.cabal +7/−6
- src/Json.hs +4/−3
- src/Json/Smile.hs +1/−0
- test/Main.hs +4/−3
CHANGELOG.md view
@@ -1,5 +1,10 @@ # Revision history for json-syntax +## 0.2.2.0 -- 2022-07-15++* Build with GHC 9.2.3.+* Test suite now requires aeson >= 2.0 instead of < 2.0.+ ## 0.2.1.0 -- 2022-03-01 * Support Jackson's SMILE format as an encode target.
json-syntax.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: json-syntax-version: 0.2.1.0+version: 0.2.2.0 synopsis: High-performance JSON parser and encoder description: This library parses JSON into a @Value@ type that is consistent with the@@ -36,14 +36,15 @@ , bytebuild >=0.3.10 && <0.4 , byteslice >=0.1.3 && <0.3 , bytesmith >=0.3.8 && <0.4- , bytestring >=0.10.8 && <0.11- , integer-gmp >=1.0 && <1.1+ , bytestring >=0.10.8 && <0.12+ , integer-gmp >=1.0 && <1.2 , natural-arithmetic >=0.1.2 && <0.2 , contiguous >=0.6 && <0.7 , primitive >=0.7 && <0.8 , run-st >=0.1.1 && <0.2- , scientific-notation >=0.1.2 && <0.2+ , scientific-notation >=0.1.5 && <0.2 , text-short >=0.1.3 && <0.2+ , word-compat >=0.0.3 , zigzag >=0.0.1 hs-source-dirs: src default-language: Haskell2010@@ -59,12 +60,13 @@ ghc-options: -Wall -O2 build-depends: , QuickCheck >=2.14.2- , aeson <2.0+ , aeson >=2.0.2 , array-chunks , base >=4.12.0.0 && <5 , bytebuild , byteslice >=0.1.3 , bytestring+ , containers , json-syntax , neat-interpolation >=0.3.2 , primitive@@ -76,7 +78,6 @@ , tasty-quickcheck >=0.10.1.2 && <0.11 , text >=1.2 , text-short- , unordered-containers , vector benchmark bench
src/Json.hs view
@@ -53,7 +53,7 @@ import Data.Primitive (ByteArray,MutableByteArray,SmallArray) import Data.Text.Short (ShortText) import GHC.Exts (Char(C#),Int(I#),gtWord#,ltWord#,word2Int#,chr#)-import GHC.Word (Word8(W8#),Word16(W16#))+import GHC.Word (Word8,Word16) import qualified Prelude import qualified Data.Builder.ST as B@@ -67,6 +67,7 @@ import qualified Data.Bytes.Parser.Latin as Latin import qualified Data.ByteString.Short.Internal as BSS import qualified Data.Bytes.Parser.Unsafe as Unsafe+import qualified GHC.Word.Compat -- | The JSON syntax tree described by the ABNF in RFC 7159. Notable -- design decisions include:@@ -342,7 +343,7 @@ let end = pos - 1 let maxLen = end - start copyAndEscape wrap maxLen- W8# w -> go (canMemcpy .&. I# (ltWord# w 128##) .&. I# (gtWord# w 31##))+ GHC.Word.Compat.W8# w -> go (canMemcpy .&. I# (ltWord# w 128##) .&. I# (gtWord# w 31##)) copyAndEscape :: (ShortText -> a) -> Int -> Parser SyntaxException s a {-# inline copyAndEscape #-}@@ -422,7 +423,7 @@ -- Precondition: Not in the range [U+D800 .. U+DFFF] w16ToChar :: Word16 -> Char-w16ToChar (W16# w) = C# (chr# (word2Int# w))+w16ToChar (GHC.Word.Compat.W16# w) = C# (chr# (word2Int# w)) -- | Infix pattern synonym for 'Member'. pattern (:->) :: ShortText -> Value -> Member
src/Json/Smile.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE BangPatterns #-} {-# LANGUAGE DataKinds #-}+{-# LANGUAGE GADTs #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE ScopedTypeVariables #-}
test/Main.hs view
@@ -22,7 +22,8 @@ import qualified Data.Bytes.Text.Ascii as Ascii import qualified Data.Bytes.Text.Latin1 as Latin1 import qualified Data.ByteString as BS-import qualified Data.HashMap.Strict as HM+import qualified Data.Aeson.Key as Key+import qualified Data.Aeson.KeyMap as M import qualified Data.Number.Scientific as SCI import qualified Data.Text.Short as TS import qualified GHC.Exts as Exts@@ -227,8 +228,8 @@ J.String t -> AE.String (TS.toText t) J.Number n -> AE.Number (toBadSci n) J.Object mbrs -> AE.Object $ foldr- (\(J.Member key val) hm -> HM.insert (TS.toText key) (toAesonValue val) hm)- HM.empty mbrs+ (\(J.Member key val) hm -> M.insert (Key.fromShortText key) (toAesonValue val) hm)+ M.empty mbrs J.Array vals -> AE.Array $ Exts.fromList $ foldr (\x xs -> toAesonValue x : xs) [] vals