From d14db3d8dcae9b4ed6dfed4e3a4f801b9007227e Mon Sep 17 00:00:00 2001 From: Andrew Martin Date: Mon, 14 Jul 2025 10:26:17 -0400 Subject: [PATCH 1/4] Remove dollar operator to fix GHC 9.6 build --- CHANGELOG.md | 2 +- json-syntax.cabal | 2 +- src/Json.hs | 17 ++++++++--------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4addacc..26f2ab1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Revision history for json-syntax -## 0.3.0.1 -- 2025-07-14 +## 0.3.0.2 -- 2025-07-14 * Switch from ShortText to Text. In many cases, this makes it possible for the resulting Value to share the input byte array instead of allocating additional diff --git a/json-syntax.cabal b/json-syntax.cabal index 5182493..49d0a01 100644 --- a/json-syntax.cabal +++ b/json-syntax.cabal @@ -1,6 +1,6 @@ cabal-version: 2.2 name: json-syntax -version: 0.3.0.1 +version: 0.3.0.2 synopsis: High-performance JSON parser and encoder description: This library parses JSON into a @Value@ type that is consistent with the diff --git a/src/Json.hs b/src/Json.hs index b86274d..c59b454 100644 --- a/src/Json.hs +++ b/src/Json.hs @@ -83,7 +83,7 @@ import Control.Monad.ST (ST, runST) import Control.Monad.ST.Run (runSmallArrayST) import Control.Monad.Trans.Class (lift) import Control.Monad.Trans.Except (except, runExceptT) -import Data.Bits (unsafeShiftR, (.&.), (.|.), xor) +import Data.Bits (unsafeShiftR, (.&.), (.|.)) import Data.Builder.ST (Builder) import Data.Bytes.Chunks (Chunks) import Data.Bytes.Parser (Parser) @@ -94,12 +94,12 @@ import Data.Number.Scientific (Scientific) import Data.Primitive (Array, ByteArray (ByteArray), MutableByteArray, Prim, PrimArray, SmallArray) import Data.Text.Internal (Text(Text)) import Data.Text.Short (ShortText) -import GHC.Exts (Char (C#), Int (I#), chr#, gtWord#, ltWord#, word2Int#, minusWord#) -import GHC.Exts (Int#, ByteArray#, word8ToWord#, word16ToWord#) +import GHC.Exts (Char (C#), Int (I#), ltWord#, minusWord#) +import GHC.Exts (Int#, ByteArray#, word8ToWord#) import GHC.Exts (RuntimeRep(IntRep,TupleRep,BoxedRep), Levity(Unlifted)) import GHC.Exts (and#, xor#) import GHC.Int (Int16, Int32, Int64, Int8) -import GHC.Word (Word16(W16#), Word32, Word64, Word8(W8#), Word(W#)) +import GHC.Word (Word16, Word32, Word64, Word8(W8#), Word(W#)) import qualified Data.Builder.ST as B import qualified Data.ByteString.Short.Internal as BSS @@ -115,11 +115,9 @@ import qualified Data.List as List import qualified Data.Number.Scientific as SCI import qualified Data.Primitive as PM import qualified Data.Primitive.Contiguous as Contiguous -import qualified Data.Text import qualified Data.Text.Short as TS import qualified Data.Text.Short.Unsafe as TS import qualified Prelude -import qualified Data.Bytes.Parser.Rebindable as RB {- | The JSON syntax tree described by the ABNF in RFC 7159. Notable design decisions include: @@ -552,9 +550,10 @@ copyAndEscape# !maxLen = 0x22 -> (P.effect (PM.unsafeFreezeByteArray =<< PM.resizeMutableByteArray dst ix)) `P.bindFromLiftedToByteArrayIntInt` \str -> - P.pureByteArrayIntInt $ case byteArrayToShortByteString str of - BSS.SBS str' -> -- error ("Escaped string: " ++ Data.Text.unpack (Text (ByteArray str') 0 (I# ix#))) - (# str', 0#, ix# #) + P.pureByteArrayIntInt + ( case byteArrayToShortByteString str of + BSS.SBS str' -> (# str', 0#, ix# #) + ) _ | theCharW >= 0x20, theCharW < 127 -> (P.effect (PM.writeByteArray dst ix theCharW)) `P.bindFromLiftedToByteArrayIntInt` \_ -> From fd8b1014ca8d34baaaa8da35c4814aa24b69f9ff Mon Sep 17 00:00:00 2001 From: Andrew Martin Date: Mon, 14 Jul 2025 10:43:14 -0400 Subject: [PATCH 2/4] Stop building with GHC 9.4 in CI --- json-syntax.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json-syntax.cabal b/json-syntax.cabal index 49d0a01..44595ab 100644 --- a/json-syntax.cabal +++ b/json-syntax.cabal @@ -28,7 +28,7 @@ extra-doc-files: CHANGELOG.md README.md -tested-with: GHC ==9.4.8 || ==9.6.3 || ==9.8.1 +tested-with: ==9.6.3 || ==9.8.4 common build-settings default-language: Haskell2010 From 6dfa3a861a18a179cfa3180e774355d843fa592f Mon Sep 17 00:00:00 2001 From: Andrew Martin Date: Mon, 14 Jul 2025 10:47:31 -0400 Subject: [PATCH 3/4] Build with GHC 9.8.1 instead of 9.8.4 in CI --- json-syntax.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json-syntax.cabal b/json-syntax.cabal index 44595ab..7b8544e 100644 --- a/json-syntax.cabal +++ b/json-syntax.cabal @@ -28,7 +28,7 @@ extra-doc-files: CHANGELOG.md README.md -tested-with: ==9.6.3 || ==9.8.4 +tested-with: ==9.6.3 || ==9.8.1 common build-settings default-language: Haskell2010 From 1018b9246a431e3e0f19272b1c5efb1363aa0a77 Mon Sep 17 00:00:00 2001 From: Andrew Martin Date: Mon, 14 Jul 2025 10:57:58 -0400 Subject: [PATCH 4/4] Correct tested-with --- json-syntax.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json-syntax.cabal b/json-syntax.cabal index 7b8544e..2494051 100644 --- a/json-syntax.cabal +++ b/json-syntax.cabal @@ -28,7 +28,7 @@ extra-doc-files: CHANGELOG.md README.md -tested-with: ==9.6.3 || ==9.8.1 +tested-with: GHC ==9.6.3 || ==9.8.1 common build-settings default-language: Haskell2010