Skip to content

Commit 43d5331

Browse files
committed
Build with GHC 9.2 and release as 0.2.2.0
1 parent e6ea47a commit 43d5331

File tree

5 files changed

+19
-10
lines changed

5 files changed

+19
-10
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Revision history for json-syntax
22

3+
## 0.2.2.0 -- 2022-07-15
4+
5+
* Build with GHC 9.2.3.
6+
* Test suite now requires aeson >= 2.0 instead of < 2.0.
7+
38
## 0.2.1.0 -- 2022-03-01
49

510
* Support Jackson's SMILE format as an encode target.

json-syntax.cabal

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.2
22
name: json-syntax
3-
version: 0.2.1.0
3+
version: 0.2.2.0
44
synopsis: High-performance JSON parser and encoder
55
description:
66
This library parses JSON into a @Value@ type that is consistent with the
@@ -42,8 +42,9 @@ library
4242
, contiguous >=0.6 && <0.7
4343
, primitive >=0.7 && <0.8
4444
, run-st >=0.1.1 && <0.2
45-
, scientific-notation >=0.1.2 && <0.2
45+
, scientific-notation >=0.1.5 && <0.2
4646
, text-short >=0.1.3 && <0.2
47+
, word-compat >=0.0.3
4748
, zigzag >=0.0.1
4849
hs-source-dirs: src
4950
default-language: Haskell2010
@@ -59,12 +60,13 @@ test-suite test
5960
ghc-options: -Wall -O2
6061
build-depends:
6162
, QuickCheck >=2.14.2
62-
, aeson <2.0
63+
, aeson >=2.0.2
6364
, array-chunks
6465
, base >=4.12.0.0 && <5
6566
, bytebuild
6667
, byteslice >=0.1.3
6768
, bytestring
69+
, containers
6870
, json-syntax
6971
, neat-interpolation >=0.3.2
7072
, primitive
@@ -76,7 +78,6 @@ test-suite test
7678
, tasty-quickcheck >=0.10.1.2 && <0.11
7779
, text >=1.2
7880
, text-short
79-
, unordered-containers
8081
, vector
8182

8283
benchmark bench

src/Json.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import Data.Number.Scientific (Scientific)
5353
import Data.Primitive (ByteArray,MutableByteArray,SmallArray)
5454
import Data.Text.Short (ShortText)
5555
import GHC.Exts (Char(C#),Int(I#),gtWord#,ltWord#,word2Int#,chr#)
56-
import GHC.Word (Word8(W8#),Word16(W16#))
56+
import GHC.Word (Word8,Word16)
5757

5858
import qualified Prelude
5959
import qualified Data.Builder.ST as B
@@ -67,6 +67,7 @@ import qualified Data.Bytes.Parser.Utf8 as Utf8
6767
import qualified Data.Bytes.Parser.Latin as Latin
6868
import qualified Data.ByteString.Short.Internal as BSS
6969
import qualified Data.Bytes.Parser.Unsafe as Unsafe
70+
import qualified GHC.Word.Compat
7071

7172
-- | The JSON syntax tree described by the ABNF in RFC 7159. Notable
7273
-- design decisions include:
@@ -342,7 +343,7 @@ string wrap !start = go 1 where
342343
let end = pos - 1
343344
let maxLen = end - start
344345
copyAndEscape wrap maxLen
345-
W8# w -> go (canMemcpy .&. I# (ltWord# w 128##) .&. I# (gtWord# w 31##))
346+
GHC.Word.Compat.W8# w -> go (canMemcpy .&. I# (ltWord# w 128##) .&. I# (gtWord# w 31##))
346347

347348
copyAndEscape :: (ShortText -> a) -> Int -> Parser SyntaxException s a
348349
{-# inline copyAndEscape #-}
@@ -422,7 +423,7 @@ byteArrayToShortByteString (PM.ByteArray x) = BSS.SBS x
422423

423424
-- Precondition: Not in the range [U+D800 .. U+DFFF]
424425
w16ToChar :: Word16 -> Char
425-
w16ToChar (W16# w) = C# (chr# (word2Int# w))
426+
w16ToChar (GHC.Word.Compat.W16# w) = C# (chr# (word2Int# w))
426427

427428
-- | Infix pattern synonym for 'Member'.
428429
pattern (:->) :: ShortText -> Value -> Member

src/Json/Smile.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{-# LANGUAGE BangPatterns #-}
22
{-# LANGUAGE DataKinds #-}
3+
{-# LANGUAGE GADTs #-}
34
{-# LANGUAGE MagicHash #-}
45
{-# LANGUAGE NamedFieldPuns #-}
56
{-# LANGUAGE ScopedTypeVariables #-}

test/Main.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ import qualified Data.Bytes.Chunks as BChunks
2222
import qualified Data.Bytes.Text.Ascii as Ascii
2323
import qualified Data.Bytes.Text.Latin1 as Latin1
2424
import qualified Data.ByteString as BS
25-
import qualified Data.HashMap.Strict as HM
25+
import qualified Data.Aeson.Key as Key
26+
import qualified Data.Aeson.KeyMap as M
2627
import qualified Data.Number.Scientific as SCI
2728
import qualified Data.Text.Short as TS
2829
import qualified GHC.Exts as Exts
@@ -227,8 +228,8 @@ toAesonValue = \case
227228
J.String t -> AE.String (TS.toText t)
228229
J.Number n -> AE.Number (toBadSci n)
229230
J.Object mbrs -> AE.Object $ foldr
230-
(\(J.Member key val) hm -> HM.insert (TS.toText key) (toAesonValue val) hm)
231-
HM.empty mbrs
231+
(\(J.Member key val) hm -> M.insert (Key.fromShortText key) (toAesonValue val) hm)
232+
M.empty mbrs
232233
J.Array vals -> AE.Array $ Exts.fromList $ foldr
233234
(\x xs -> toAesonValue x : xs) [] vals
234235

0 commit comments

Comments
 (0)