From 009dec8b6da4b7823534055aa90f24cbe20570ac Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Sat, 18 Jan 2025 20:12:15 -0800 Subject: [PATCH 01/10] Unpin haskell-actions/setup --- .github/workflows/ghc-compat-test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ghc-compat-test.yml b/.github/workflows/ghc-compat-test.yml index 40de2ed1..392897ca 100644 --- a/.github/workflows/ghc-compat-test.yml +++ b/.github/workflows/ghc-compat-test.yml @@ -18,10 +18,11 @@ jobs: - id: setup name: Set up GHC ${{ inputs.ghc_version }} - uses: brandonchinn178/haskell-actions-setup@3f2715436c49e3e1c7b19450d595348512bbe8eb + uses: haskell-actions/setup@v2 with: ghc-version: ${{ inputs.ghc_version }} - ghcup-release-channels: https://ghc.gitlab.haskell.org/ghcup-metadata/ghcup-nightlies-0.0.7.yaml + cabal-version: '3.10' + ghcup-release-channel: https://ghc.gitlab.haskell.org/ghcup-metadata/ghcup-nightlies-0.0.7.yaml - name: Configure the build run: From 2880b746503ded34b71cd1a87a9e930b249190d8 Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Fri, 20 Dec 2024 17:11:59 -0800 Subject: [PATCH 02/10] Replace hint with process --- aeson-schemas.cabal | 3 +-- package.yaml | 1 - test/Tests/GetQQ.hs | 19 +++++++++----- test/goldens/ghc/9.4/getqq_missing_key.golden | 26 +++++++++++++++++++ test/goldens/ghc/9.6/getqq_missing_key.golden | 26 +++++++++++++++++++ test/goldens/ghc/9.8/getqq_missing_key.golden | 26 +++++++++++++++++++ 6 files changed, 92 insertions(+), 9 deletions(-) diff --git a/aeson-schemas.cabal b/aeson-schemas.cabal index a8f5d34d..192ef45b 100644 --- a/aeson-schemas.cabal +++ b/aeson-schemas.cabal @@ -1,6 +1,6 @@ cabal-version: >= 1.10 --- This file has been generated from package.yaml by hpack version 0.36.0. +-- This file has been generated from package.yaml by hpack version 0.37.0. -- -- see: https://github.com/sol/hpack @@ -125,7 +125,6 @@ test-suite aeson-schemas-test , base , deepseq , filepath - , hint , interpolate , process , raw-strings-qq diff --git a/package.yaml b/package.yaml index cdb2e13f..6bd3641b 100644 --- a/package.yaml +++ b/package.yaml @@ -62,7 +62,6 @@ tests: - base - deepseq - filepath - - hint - interpolate - process - QuickCheck diff --git a/test/Tests/GetQQ.hs b/test/Tests/GetQQ.hs index a33888be..6d7a58f5 100644 --- a/test/Tests/GetQQ.hs +++ b/test/Tests/GetQQ.hs @@ -13,13 +13,14 @@ module Tests.GetQQ where import Control.DeepSeq (deepseq) -import Control.Exception (SomeException, displayException, try) +import Control.Exception (SomeException, try) import Data.Aeson (FromJSON (..), ToJSON (..), withText) import Data.Aeson.QQ (aesonQQ) import Data.Text (Text) import qualified Data.Text as Text -import qualified Language.Haskell.Interpreter as Hint +import System.Exit (ExitCode (..)) import System.FilePath (()) +import System.Process (readProcessWithExitCode) import Test.Tasty import Test.Tasty.HUnit import Test.Tasty.QuickCheck @@ -401,10 +402,16 @@ testCompileTimeErrors = ] where testDir = "test/wont-compile/" - getCompileError fp = - Hint.runInterpreter (Hint.loadModules [fp]) >>= \case - Left e -> pure $ displayException e - Right _ -> error "Compilation unexpectedly succeeded" + getCompileError fp = do + (code, stdout, stderr) <- readProcessWithExitCode "ghc" [fp] "" + case code of + ExitFailure _ -> pure stderr + ExitSuccess -> + error . unlines $ + [ "Unexpectedly succeeded:" + , stdout + , stderr + ] {- Helpers -} diff --git a/test/goldens/ghc/9.4/getqq_missing_key.golden b/test/goldens/ghc/9.4/getqq_missing_key.golden index c55275f5..81315a59 100644 --- a/test/goldens/ghc/9.4/getqq_missing_key.golden +++ b/test/goldens/ghc/9.4/getqq_missing_key.golden @@ -1,3 +1,4 @@ + test/wont-compile/GetMissingKey.hs:17:15: error: • Key 'missing' does not exist in the following schema: '[ '( 'Data.Aeson.Schema.Key.NormalKey "foo", @@ -16,3 +17,28 @@ test/wont-compile/GetMissingKey.hs:17:15: error: . Data.Aeson.Schema.Internal.getKey (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")) o) + | +17 | result = [get| o.missing |] + | ^^^^^^^^^^^^^ + +test/wont-compile/GetMissingKey.hs:17:15: error: + • Key 'missing' does not exist in the following schema: + '[ '( 'Data.Aeson.Schema.Key.NormalKey "foo", + 'Data.Aeson.Schema.Type.SchemaScalar Bool)] + • In the second argument of ‘(.)’, namely + ‘Data.Aeson.Schema.Internal.getKey + (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")’ + In the expression: + (id + . Data.Aeson.Schema.Internal.getKey + (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")) + o + In an equation for ‘result’: + result + = ((id + . Data.Aeson.Schema.Internal.getKey + (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")) + o) + | +17 | result = [get| o.missing |] + | ^^^^^^^^^^^^^ diff --git a/test/goldens/ghc/9.6/getqq_missing_key.golden b/test/goldens/ghc/9.6/getqq_missing_key.golden index 7da17e48..51e88d58 100644 --- a/test/goldens/ghc/9.6/getqq_missing_key.golden +++ b/test/goldens/ghc/9.6/getqq_missing_key.golden @@ -1,3 +1,4 @@ + test/wont-compile/GetMissingKey.hs:17:15: error: [GHC-64725] • Key 'missing' does not exist in the following schema: '[ '(Data.Aeson.Schema.Key.NormalKey "foo", @@ -16,3 +17,28 @@ test/wont-compile/GetMissingKey.hs:17:15: error: [GHC-64725] . Data.Aeson.Schema.Internal.getKey (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")) o) + | +17 | result = [get| o.missing |] + | ^^^^^^^^^^^^^ + +test/wont-compile/GetMissingKey.hs:17:15: error: [GHC-64725] + • Key 'missing' does not exist in the following schema: + '[ '(Data.Aeson.Schema.Key.NormalKey "foo", + Data.Aeson.Schema.Type.SchemaScalar Bool)] + • In the second argument of ‘(.)’, namely + ‘Data.Aeson.Schema.Internal.getKey + (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")’ + In the expression: + (id + . Data.Aeson.Schema.Internal.getKey + (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")) + o + In an equation for ‘result’: + result + = ((id + . Data.Aeson.Schema.Internal.getKey + (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")) + o) + | +17 | result = [get| o.missing |] + | ^^^^^^^^^^^^^ diff --git a/test/goldens/ghc/9.8/getqq_missing_key.golden b/test/goldens/ghc/9.8/getqq_missing_key.golden index 7da17e48..51e88d58 100644 --- a/test/goldens/ghc/9.8/getqq_missing_key.golden +++ b/test/goldens/ghc/9.8/getqq_missing_key.golden @@ -1,3 +1,4 @@ + test/wont-compile/GetMissingKey.hs:17:15: error: [GHC-64725] • Key 'missing' does not exist in the following schema: '[ '(Data.Aeson.Schema.Key.NormalKey "foo", @@ -16,3 +17,28 @@ test/wont-compile/GetMissingKey.hs:17:15: error: [GHC-64725] . Data.Aeson.Schema.Internal.getKey (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")) o) + | +17 | result = [get| o.missing |] + | ^^^^^^^^^^^^^ + +test/wont-compile/GetMissingKey.hs:17:15: error: [GHC-64725] + • Key 'missing' does not exist in the following schema: + '[ '(Data.Aeson.Schema.Key.NormalKey "foo", + Data.Aeson.Schema.Type.SchemaScalar Bool)] + • In the second argument of ‘(.)’, namely + ‘Data.Aeson.Schema.Internal.getKey + (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")’ + In the expression: + (id + . Data.Aeson.Schema.Internal.getKey + (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")) + o + In an equation for ‘result’: + result + = ((id + . Data.Aeson.Schema.Internal.getKey + (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")) + o) + | +17 | result = [get| o.missing |] + | ^^^^^^^^^^^^^ From bf4ff7edb55df47fc501c951a84120da038532a1 Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Fri, 20 Dec 2024 17:14:50 -0800 Subject: [PATCH 03/10] Update nightly version --- aeson-schemas.cabal | 1 - test/goldens/ghc/9.9/getqq_missing_key.golden | 18 ------------------ 2 files changed, 19 deletions(-) delete mode 100644 test/goldens/ghc/9.9/getqq_missing_key.golden diff --git a/aeson-schemas.cabal b/aeson-schemas.cabal index 192ef45b..0204ca23 100644 --- a/aeson-schemas.cabal +++ b/aeson-schemas.cabal @@ -42,7 +42,6 @@ extra-source-files: test/goldens/ghc/9.4/getqq_missing_key.golden test/goldens/ghc/9.6/getqq_missing_key.golden test/goldens/ghc/9.8/getqq_missing_key.golden - test/goldens/ghc/9.9/getqq_missing_key.golden test/goldens/README_Quickstart.golden test/goldens/schemaqq_key_with_invalid_character.golden test/goldens/schemaqq_key_with_trailing_escape.golden diff --git a/test/goldens/ghc/9.9/getqq_missing_key.golden b/test/goldens/ghc/9.9/getqq_missing_key.golden deleted file mode 100644 index 7da17e48..00000000 --- a/test/goldens/ghc/9.9/getqq_missing_key.golden +++ /dev/null @@ -1,18 +0,0 @@ -test/wont-compile/GetMissingKey.hs:17:15: error: [GHC-64725] - • Key 'missing' does not exist in the following schema: - '[ '(Data.Aeson.Schema.Key.NormalKey "foo", - Data.Aeson.Schema.Type.SchemaScalar Bool)] - • In the second argument of ‘(.)’, namely - ‘Data.Aeson.Schema.Internal.getKey - (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")’ - In the expression: - (id - . Data.Aeson.Schema.Internal.getKey - (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")) - o - In an equation for ‘result’: - result - = ((id - . Data.Aeson.Schema.Internal.getKey - (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")) - o) From 05395ab330c66f22b420ee472a6707c7b1c30ea6 Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Fri, 20 Dec 2024 17:13:26 -0800 Subject: [PATCH 04/10] Add support for GHC 9.10 + 9.12 --- .github/workflows/ci.yml | 4 +- .github/workflows/ghc-compat-test.yml | 22 ++++++++ CHANGELOG.md | 2 + aeson-schemas.cabal | 4 +- bench/Utils/DeepSeq.hs | 4 ++ package.yaml | 2 +- src/Data/Aeson/Schema/Utils/Compat.hs | 3 ++ stack.yaml | 3 ++ stack.yaml.lock | 9 +++- test/TestUtils/DeepSeq.hs | 4 ++ .../goldens/ghc/9.10/getqq_missing_key.golden | 50 +++++++++++++++++++ .../goldens/ghc/9.12/getqq_missing_key.golden | 50 +++++++++++++++++++ 12 files changed, 153 insertions(+), 4 deletions(-) create mode 100644 test/goldens/ghc/9.10/getqq_missing_key.golden create mode 100644 test/goldens/ghc/9.12/getqq_missing_key.golden diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2f0a2ab6..cabc1fd4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: - name: Convert coverage output run: | - HPC_LCOV_VERSION=1.1.1 + HPC_LCOV_VERSION=1.2.0 curl -fsSL \ "https://github.com/brandonchinn178/hpc-lcov/releases/download/v${HPC_LCOV_VERSION}/hpc-lcov-${HPC_LCOV_VERSION}-linux-x86_64" \ -o /usr/local/bin/hpc-lcov @@ -45,6 +45,8 @@ jobs: - '9.4' - '9.6' - '9.8' + - '9.10' + - '9.12' include: - ghc_version: 9.4.1 oldest: true diff --git a/.github/workflows/ghc-compat-test.yml b/.github/workflows/ghc-compat-test.yml index 392897ca..c21e7ac7 100644 --- a/.github/workflows/ghc-compat-test.yml +++ b/.github/workflows/ghc-compat-test.yml @@ -32,6 +32,28 @@ jobs: --enable-bench --test-options=--color=always --test-show-details=streaming + - + # TODO: remove when packages are updated + name: Allow building deps with GHC 9.12 + run: + cabal configure --enable-append + --allow-newer=aeson:ghc-prim + --allow-newer=aeson:template-haskell + --allow-newer=binary-orphans:base + --allow-newer=haskell-src-meta:template-haskell + --allow-newer=indexed-traversable-instances:base + --allow-newer=indexed-traversable:base + --allow-newer=integer-conversion:base + --allow-newer=microstache:base + --allow-newer=scientific:base + --allow-newer=scientific:template-haskell + --allow-newer=semialign:base + --allow-newer=text:deepseq + --allow-newer=these:base + --allow-newer=time-compat:base + --allow-newer=time-compat:time + --allow-newer=unordered-containers:template-haskell + --allow-newer=uuid-types:template-haskell - if: ${{ inputs.oldest }} name: Use oldest dependencies diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b4cfe8b..910709b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Unreleased +* Add support for GHC 9.10 + 9.12 + # v1.4.2.1 * Fix benchmarks for GHC 9.8 diff --git a/aeson-schemas.cabal b/aeson-schemas.cabal index 0204ca23..aac2d803 100644 --- a/aeson-schemas.cabal +++ b/aeson-schemas.cabal @@ -39,6 +39,8 @@ extra-source-files: test/goldens/getqq_no_operators.golden test/goldens/getqq_ops_after_list.golden test/goldens/getqq_ops_after_tuple.golden + test/goldens/ghc/9.10/getqq_missing_key.golden + test/goldens/ghc/9.12/getqq_missing_key.golden test/goldens/ghc/9.4/getqq_missing_key.golden test/goldens/ghc/9.6/getqq_missing_key.golden test/goldens/ghc/9.8/getqq_missing_key.golden @@ -83,7 +85,7 @@ library , first-class-families <0.9 , hashable <1.6 , megaparsec <10 - , template-haskell <2.22 + , template-haskell <2.24 , text <2.2 , unordered-containers <0.3 default-language: Haskell2010 diff --git a/bench/Utils/DeepSeq.hs b/bench/Utils/DeepSeq.hs index 52d7a089..28d55a00 100644 --- a/bench/Utils/DeepSeq.hs +++ b/bench/Utils/DeepSeq.hs @@ -68,5 +68,9 @@ instance NFData BndrVis instance NFData Bytes +#if MIN_VERSION_template_haskell(2,22,0) +instance NFData NamespaceSpecifier +#endif + instance NFData (ForeignPtr a) where rnf = rwhnf diff --git a/package.yaml b/package.yaml index 6bd3641b..e7c05ce1 100644 --- a/package.yaml +++ b/package.yaml @@ -47,7 +47,7 @@ library: - first-class-families < 0.9 - hashable < 1.6 - megaparsec < 10 - - template-haskell < 2.22 + - template-haskell < 2.24 - text < 2.2 - unordered-containers < 0.3 diff --git a/src/Data/Aeson/Schema/Utils/Compat.hs b/src/Data/Aeson/Schema/Utils/Compat.hs index 7fc17b7c..020c16e9 100644 --- a/src/Data/Aeson/Schema/Utils/Compat.hs +++ b/src/Data/Aeson/Schema/Utils/Compat.hs @@ -13,7 +13,10 @@ module Data.Aeson.Schema.Utils.Compat ( unions, ) where +#if !MIN_VERSION_base(4,20,0) import Data.List (foldl') +#endif + import Data.Text (Text) import Prelude hiding (lookup) diff --git a/stack.yaml b/stack.yaml index d45600cf..9bb0285e 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1 +1,4 @@ resolver: lts-22.28 + +extra-deps: + - th-test-utils-1.2.2 diff --git a/stack.yaml.lock b/stack.yaml.lock index 0dd02f64..85c6f860 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -3,7 +3,14 @@ # For more information, please see the documentation at: # https://docs.haskellstack.org/en/stable/lock_files -packages: [] +packages: +- completed: + hackage: th-test-utils-1.2.2@sha256:d7b02eb9d2613e5e624298826ba03d4c11e18fa2fb8d4e378569224ae687fc4e,2193 + pantry-tree: + sha256: eacb82118c7a96fc0e4ee9a45e3283155987b13fa21b8f65954acb1a55cdf50f + size: 620 + original: + hackage: th-test-utils-1.2.2 snapshots: - completed: sha256: 87da71cb0ae9ee1ea1bf51a8eb9812f39f779be76abc0a3c926defd8afda05d1 diff --git a/test/TestUtils/DeepSeq.hs b/test/TestUtils/DeepSeq.hs index c61fe2a9..4dd45d7a 100644 --- a/test/TestUtils/DeepSeq.hs +++ b/test/TestUtils/DeepSeq.hs @@ -68,5 +68,9 @@ instance NFData BndrVis instance NFData Bytes +#if MIN_VERSION_template_haskell(2,22,0) +instance NFData NamespaceSpecifier +#endif + instance NFData (ForeignPtr a) where rnf = rwhnf diff --git a/test/goldens/ghc/9.10/getqq_missing_key.golden b/test/goldens/ghc/9.10/getqq_missing_key.golden new file mode 100644 index 00000000..cdaee539 --- /dev/null +++ b/test/goldens/ghc/9.10/getqq_missing_key.golden @@ -0,0 +1,50 @@ +test/wont-compile/GetMissingKey.hs:17:15: error: [GHC-64725] + • Key 'missing' does not exist in the following schema: + '[ '(Data.Aeson.Schema.Key.NormalKey "foo", + Data.Aeson.Schema.Type.SchemaScalar Bool)] + • In the second argument of ‘(.)’, namely + ‘Data.Aeson.Schema.Internal.getKey + (GHC.Internal.Data.Proxy.Proxy :: + GHC.Internal.Data.Proxy.Proxy "missing")’ + In the expression: + (id + . Data.Aeson.Schema.Internal.getKey + (GHC.Internal.Data.Proxy.Proxy :: + GHC.Internal.Data.Proxy.Proxy "missing")) + o + In an equation for ‘result’: + result + = ((id + . Data.Aeson.Schema.Internal.getKey + (GHC.Internal.Data.Proxy.Proxy :: + GHC.Internal.Data.Proxy.Proxy "missing")) + o) + | +17 | result = [get| o.missing |] + | ^^^^^^^^^^^^^ + +test/wont-compile/GetMissingKey.hs:17:15: error: [GHC-64725] + • Key 'missing' does not exist in the following schema: + '[ '(Data.Aeson.Schema.Key.NormalKey "foo", + Data.Aeson.Schema.Type.SchemaScalar Bool)] + • In the second argument of ‘(.)’, namely + ‘Data.Aeson.Schema.Internal.getKey + (GHC.Internal.Data.Proxy.Proxy :: + GHC.Internal.Data.Proxy.Proxy "missing")’ + In the expression: + (id + . Data.Aeson.Schema.Internal.getKey + (GHC.Internal.Data.Proxy.Proxy :: + GHC.Internal.Data.Proxy.Proxy "missing")) + o + In an equation for ‘result’: + result + = ((id + . Data.Aeson.Schema.Internal.getKey + (GHC.Internal.Data.Proxy.Proxy :: + GHC.Internal.Data.Proxy.Proxy "missing")) + o) + | +17 | result = [get| o.missing |] + | ^^^^^^^^^^^^^ + diff --git a/test/goldens/ghc/9.12/getqq_missing_key.golden b/test/goldens/ghc/9.12/getqq_missing_key.golden new file mode 100644 index 00000000..cdaee539 --- /dev/null +++ b/test/goldens/ghc/9.12/getqq_missing_key.golden @@ -0,0 +1,50 @@ +test/wont-compile/GetMissingKey.hs:17:15: error: [GHC-64725] + • Key 'missing' does not exist in the following schema: + '[ '(Data.Aeson.Schema.Key.NormalKey "foo", + Data.Aeson.Schema.Type.SchemaScalar Bool)] + • In the second argument of ‘(.)’, namely + ‘Data.Aeson.Schema.Internal.getKey + (GHC.Internal.Data.Proxy.Proxy :: + GHC.Internal.Data.Proxy.Proxy "missing")’ + In the expression: + (id + . Data.Aeson.Schema.Internal.getKey + (GHC.Internal.Data.Proxy.Proxy :: + GHC.Internal.Data.Proxy.Proxy "missing")) + o + In an equation for ‘result’: + result + = ((id + . Data.Aeson.Schema.Internal.getKey + (GHC.Internal.Data.Proxy.Proxy :: + GHC.Internal.Data.Proxy.Proxy "missing")) + o) + | +17 | result = [get| o.missing |] + | ^^^^^^^^^^^^^ + +test/wont-compile/GetMissingKey.hs:17:15: error: [GHC-64725] + • Key 'missing' does not exist in the following schema: + '[ '(Data.Aeson.Schema.Key.NormalKey "foo", + Data.Aeson.Schema.Type.SchemaScalar Bool)] + • In the second argument of ‘(.)’, namely + ‘Data.Aeson.Schema.Internal.getKey + (GHC.Internal.Data.Proxy.Proxy :: + GHC.Internal.Data.Proxy.Proxy "missing")’ + In the expression: + (id + . Data.Aeson.Schema.Internal.getKey + (GHC.Internal.Data.Proxy.Proxy :: + GHC.Internal.Data.Proxy.Proxy "missing")) + o + In an equation for ‘result’: + result + = ((id + . Data.Aeson.Schema.Internal.getKey + (GHC.Internal.Data.Proxy.Proxy :: + GHC.Internal.Data.Proxy.Proxy "missing")) + o) + | +17 | result = [get| o.missing |] + | ^^^^^^^^^^^^^ + From 04ec98706e7fcf3fcf72fa5195c81fe8b250a3fc Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Fri, 20 Dec 2024 17:16:03 -0800 Subject: [PATCH 05/10] Bump stack snapshot --- stack.yaml | 2 +- stack.yaml.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/stack.yaml b/stack.yaml index 9bb0285e..ede9ce05 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,4 @@ -resolver: lts-22.28 +resolver: nightly-2024-12-20 extra-deps: - th-test-utils-1.2.2 diff --git a/stack.yaml.lock b/stack.yaml.lock index 85c6f860..0ee45fb9 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -13,7 +13,7 @@ packages: hackage: th-test-utils-1.2.2 snapshots: - completed: - sha256: 87da71cb0ae9ee1ea1bf51a8eb9812f39f779be76abc0a3c926defd8afda05d1 - size: 719139 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/28.yaml - original: lts-22.28 + sha256: 2413f1dbf803da9cab3b6970d868cf7cd4c013b8776dee3cebd8b8ecbf85514c + size: 619614 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2024/12/20.yaml + original: nightly-2024-12-20 From 3fbe8835a99664ce17ce249ab8b2403d7488871f Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Fri, 20 Dec 2024 17:13:36 -0800 Subject: [PATCH 06/10] Drop support for GHC 9.4 + 9.6 --- .github/workflows/ci.yml | 4 +- .github/workflows/ghc-compat-test.yml | 3 ++ aeson-schemas.cabal | 2 - test/goldens/ghc/9.4/getqq_missing_key.golden | 44 ------------------- test/goldens/ghc/9.6/getqq_missing_key.golden | 44 ------------------- 5 files changed, 4 insertions(+), 93 deletions(-) delete mode 100644 test/goldens/ghc/9.4/getqq_missing_key.golden delete mode 100644 test/goldens/ghc/9.6/getqq_missing_key.golden diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cabc1fd4..1bc37a0e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,13 +42,11 @@ jobs: strategy: matrix: ghc_version: - - '9.4' - - '9.6' - '9.8' - '9.10' - '9.12' include: - - ghc_version: 9.4.1 + - ghc_version: 9.8.1 oldest: true name: ghc_compat_test (${{ matrix.ghc_version }}) diff --git a/.github/workflows/ghc-compat-test.yml b/.github/workflows/ghc-compat-test.yml index c21e7ac7..c3009adb 100644 --- a/.github/workflows/ghc-compat-test.yml +++ b/.github/workflows/ghc-compat-test.yml @@ -57,9 +57,12 @@ jobs: - if: ${{ inputs.oldest }} name: Use oldest dependencies + # https://github.com/pcapriotti/optparse-applicative/issues/497 run: cabal configure --enable-append --prefer-oldest + --constraint='prettyprinter-ansi-terminal >= 1.1.2' + --constraint='haskell-src-meta >= 0.8.13' - if: ${{ inputs.ghc_version == 'latest-nightly' }} name: Add head.hackage diff --git a/aeson-schemas.cabal b/aeson-schemas.cabal index aac2d803..4fdd090d 100644 --- a/aeson-schemas.cabal +++ b/aeson-schemas.cabal @@ -41,8 +41,6 @@ extra-source-files: test/goldens/getqq_ops_after_tuple.golden test/goldens/ghc/9.10/getqq_missing_key.golden test/goldens/ghc/9.12/getqq_missing_key.golden - test/goldens/ghc/9.4/getqq_missing_key.golden - test/goldens/ghc/9.6/getqq_missing_key.golden test/goldens/ghc/9.8/getqq_missing_key.golden test/goldens/README_Quickstart.golden test/goldens/schemaqq_key_with_invalid_character.golden diff --git a/test/goldens/ghc/9.4/getqq_missing_key.golden b/test/goldens/ghc/9.4/getqq_missing_key.golden deleted file mode 100644 index 81315a59..00000000 --- a/test/goldens/ghc/9.4/getqq_missing_key.golden +++ /dev/null @@ -1,44 +0,0 @@ - -test/wont-compile/GetMissingKey.hs:17:15: error: - • Key 'missing' does not exist in the following schema: - '[ '( 'Data.Aeson.Schema.Key.NormalKey "foo", - 'Data.Aeson.Schema.Type.SchemaScalar Bool)] - • In the second argument of ‘(.)’, namely - ‘Data.Aeson.Schema.Internal.getKey - (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")’ - In the expression: - (id - . Data.Aeson.Schema.Internal.getKey - (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")) - o - In an equation for ‘result’: - result - = ((id - . Data.Aeson.Schema.Internal.getKey - (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")) - o) - | -17 | result = [get| o.missing |] - | ^^^^^^^^^^^^^ - -test/wont-compile/GetMissingKey.hs:17:15: error: - • Key 'missing' does not exist in the following schema: - '[ '( 'Data.Aeson.Schema.Key.NormalKey "foo", - 'Data.Aeson.Schema.Type.SchemaScalar Bool)] - • In the second argument of ‘(.)’, namely - ‘Data.Aeson.Schema.Internal.getKey - (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")’ - In the expression: - (id - . Data.Aeson.Schema.Internal.getKey - (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")) - o - In an equation for ‘result’: - result - = ((id - . Data.Aeson.Schema.Internal.getKey - (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")) - o) - | -17 | result = [get| o.missing |] - | ^^^^^^^^^^^^^ diff --git a/test/goldens/ghc/9.6/getqq_missing_key.golden b/test/goldens/ghc/9.6/getqq_missing_key.golden deleted file mode 100644 index 51e88d58..00000000 --- a/test/goldens/ghc/9.6/getqq_missing_key.golden +++ /dev/null @@ -1,44 +0,0 @@ - -test/wont-compile/GetMissingKey.hs:17:15: error: [GHC-64725] - • Key 'missing' does not exist in the following schema: - '[ '(Data.Aeson.Schema.Key.NormalKey "foo", - Data.Aeson.Schema.Type.SchemaScalar Bool)] - • In the second argument of ‘(.)’, namely - ‘Data.Aeson.Schema.Internal.getKey - (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")’ - In the expression: - (id - . Data.Aeson.Schema.Internal.getKey - (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")) - o - In an equation for ‘result’: - result - = ((id - . Data.Aeson.Schema.Internal.getKey - (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")) - o) - | -17 | result = [get| o.missing |] - | ^^^^^^^^^^^^^ - -test/wont-compile/GetMissingKey.hs:17:15: error: [GHC-64725] - • Key 'missing' does not exist in the following schema: - '[ '(Data.Aeson.Schema.Key.NormalKey "foo", - Data.Aeson.Schema.Type.SchemaScalar Bool)] - • In the second argument of ‘(.)’, namely - ‘Data.Aeson.Schema.Internal.getKey - (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")’ - In the expression: - (id - . Data.Aeson.Schema.Internal.getKey - (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")) - o - In an equation for ‘result’: - result - = ((id - . Data.Aeson.Schema.Internal.getKey - (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")) - o) - | -17 | result = [get| o.missing |] - | ^^^^^^^^^^^^^ From 39f70ec4689d2cae320abea0de06431761c4c7b6 Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Fri, 20 Dec 2024 17:56:27 -0800 Subject: [PATCH 07/10] Clean up macros --- bench/Utils/DeepSeq.hs | 14 +------------- src/Data/Aeson/Schema/TH/Utils.hs | 5 ----- test/TestUtils/DeepSeq.hs | 14 +------------- test/Tests/GetQQ.hs | 1 - 4 files changed, 2 insertions(+), 32 deletions(-) diff --git a/bench/Utils/DeepSeq.hs b/bench/Utils/DeepSeq.hs index 28d55a00..ee2724cd 100644 --- a/bench/Utils/DeepSeq.hs +++ b/bench/Utils/DeepSeq.hs @@ -51,21 +51,9 @@ instance NFData Type instance NFData TypeFamilyHead instance NFData TyLit instance NFData TySynEqn - -#if MIN_VERSION_template_haskell(2,17,0) instance NFData Specificity -#endif - -#if MIN_VERSION_template_haskell(2,17,0) -instance NFData flag => NFData (TyVarBndr flag) -#else -instance NFData TyVarBndr -#endif - -#if MIN_VERSION_template_haskell(2,21,0) +instance (NFData flag) => NFData (TyVarBndr flag) instance NFData BndrVis -#endif - instance NFData Bytes #if MIN_VERSION_template_haskell(2,22,0) diff --git a/src/Data/Aeson/Schema/TH/Utils.hs b/src/Data/Aeson/Schema/TH/Utils.hs index b1052ce0..83aed884 100644 --- a/src/Data/Aeson/Schema/TH/Utils.hs +++ b/src/Data/Aeson/Schema/TH/Utils.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE LambdaCase #-} @@ -197,10 +196,8 @@ stripKinds ty = AppT ty1 ty2 -> AppT (stripKinds ty1) (stripKinds ty2) InfixT ty1 name ty2 -> InfixT (stripKinds ty1) name (stripKinds ty2) UInfixT ty1 name ty2 -> UInfixT (stripKinds ty1) name (stripKinds ty2) -#if MIN_VERSION_template_haskell(2,19,0) PromotedInfixT ty1 name ty2 -> PromotedInfixT (stripKinds ty1) name (stripKinds ty2) PromotedUInfixT ty1 name ty2 -> PromotedUInfixT (stripKinds ty1) name (stripKinds ty2) -#endif ParensT ty1 -> ParensT (stripKinds ty1) ImplicitParamT str ty1 -> ImplicitParamT str (stripKinds ty1) @@ -212,9 +209,7 @@ stripKinds ty = UnboxedTupleT _ -> ty UnboxedSumT _ -> ty ArrowT -> ty -#if MIN_VERSION_template_haskell(2,17,0) MulArrowT -> ty -#endif EqualityT -> ty ListT -> ty PromotedTupleT _ -> ty diff --git a/test/TestUtils/DeepSeq.hs b/test/TestUtils/DeepSeq.hs index 4dd45d7a..bb289371 100644 --- a/test/TestUtils/DeepSeq.hs +++ b/test/TestUtils/DeepSeq.hs @@ -51,21 +51,9 @@ instance NFData Type instance NFData TypeFamilyHead instance NFData TyLit instance NFData TySynEqn - -#if MIN_VERSION_template_haskell(2,17,0) instance NFData Specificity -#endif - -#if MIN_VERSION_template_haskell(2,17,0) -instance NFData flag => NFData (TyVarBndr flag) -#else -instance NFData TyVarBndr -#endif - -#if MIN_VERSION_template_haskell(2,20,0) && __GLASGOW_HASKELL__ >= 907 +instance (NFData flag) => NFData (TyVarBndr flag) instance NFData BndrVis -#endif - instance NFData Bytes #if MIN_VERSION_template_haskell(2,22,0) diff --git a/test/Tests/GetQQ.hs b/test/Tests/GetQQ.hs index 6d7a58f5..71bc8936 100644 --- a/test/Tests/GetQQ.hs +++ b/test/Tests/GetQQ.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE KindSignatures #-} From adaca0c2228e7e36d6e1b71f341869b372e68268 Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Fri, 20 Dec 2024 17:13:46 -0800 Subject: [PATCH 08/10] Release v1.4.3.0 --- CHANGELOG.md | 3 +++ aeson-schemas.cabal | 2 +- package.yaml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 910709b6..54026119 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Unreleased +# v1.4.3.0 + +* Drop support for GHC 9.4 + 9.6 * Add support for GHC 9.10 + 9.12 # v1.4.2.1 diff --git a/aeson-schemas.cabal b/aeson-schemas.cabal index 4fdd090d..4a5f7866 100644 --- a/aeson-schemas.cabal +++ b/aeson-schemas.cabal @@ -5,7 +5,7 @@ cabal-version: >= 1.10 -- see: https://github.com/sol/hpack name: aeson-schemas -version: 1.4.2.1 +version: 1.4.3.0 synopsis: Easily consume JSON data on-demand with type-safety description: Parse JSON data easily and safely without defining new data types. Useful for deeply nested JSON data, which is difficult to parse using the default diff --git a/package.yaml b/package.yaml index e7c05ce1..4d76ab34 100644 --- a/package.yaml +++ b/package.yaml @@ -1,5 +1,5 @@ name: aeson-schemas -version: 1.4.2.1 +version: 1.4.3.0 verbatim: cabal-version: '>= 1.10' license: BSD3 From 1fbaa0a9abfe2dbd9b4916dcad88091826418793 Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Sat, 21 Dec 2024 15:29:01 -0800 Subject: [PATCH 09/10] Update docs --- DEVELOPER.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/DEVELOPER.md b/DEVELOPER.md index c506b51f..d3732a1d 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -9,6 +9,9 @@ stack build # with haddock stack build --haddock + +# with cabal +cabal build --ghc-options -Werror ``` ## Lint @@ -28,6 +31,10 @@ All tests must pass CI in order for your PR to be accepted. ```bash stack test + +# Note: use the global GHC; integration tests will not work with +# --with-compiler set differently +cabal exec -- cabal test ``` # Documentation From 36abc09d5119448d788ddeed083ef1d18ef9d9cc Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Sat, 11 Jan 2025 14:25:30 -0800 Subject: [PATCH 10/10] Fix stack/cabal discrepancy --- test/TestUtils.hs | 14 +++++++------- test/Tests/GetQQ.hs | 13 +++++++++++-- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/test/TestUtils.hs b/test/TestUtils.hs index 3008eb3d..917818ba 100644 --- a/test/TestUtils.hs +++ b/test/TestUtils.hs @@ -22,6 +22,7 @@ module TestUtils ( testGoldenIO, testParseError, ghcGoldenDir, + ghcVersion, ) where import Data.Aeson (FromJSON (..), Value, eitherDecode) @@ -34,6 +35,7 @@ import qualified Data.Text.IO as Text import qualified Data.Text.Lazy as TextL import qualified Data.Text.Lazy.Encoding as TextL import Data.Typeable (Typeable, typeRep) +import Data.Version (Version, makeVersion, showVersion, versionBranch) import Language.Haskell.TH (ExpQ) import Language.Haskell.TH.Quote (QuasiQuoter (..)) import System.FilePath (()) @@ -111,11 +113,9 @@ testParseError name fp s = goldenTest name getExpected getActual cmp update -- | The directory to put GHC version-specific golden files. ghcGoldenDir :: FilePath -ghcGoldenDir = "ghc" ghcVersion +ghcGoldenDir = "ghc" showVersion ghcMinorVersion where - ghcVersion = - Text.unpack - . Text.intercalate "." - . take 2 - . Text.splitOn "." - $ __GLASGOW_HASKELL_FULL_VERSION__ + ghcMinorVersion = makeVersion . take 2 . versionBranch $ ghcVersion + +ghcVersion :: Version +ghcVersion = makeVersion . map (read . Text.unpack) $ Text.splitOn "." __GLASGOW_HASKELL_FULL_VERSION__ diff --git a/test/Tests/GetQQ.hs b/test/Tests/GetQQ.hs index 71bc8936..d51152ce 100644 --- a/test/Tests/GetQQ.hs +++ b/test/Tests/GetQQ.hs @@ -17,6 +17,7 @@ import Data.Aeson (FromJSON (..), ToJSON (..), withText) import Data.Aeson.QQ (aesonQQ) import Data.Text (Text) import qualified Data.Text as Text +import Data.Version (makeVersion) import System.Exit (ExitCode (..)) import System.FilePath (()) import System.Process (readProcessWithExitCode) @@ -27,7 +28,7 @@ import Test.Tasty.QuickCheck import Data.Aeson.Schema (Object, schema) import Data.Aeson.Schema.TH (mkEnum) import Data.Aeson.Schema.Utils.Sum (SumType (..)) -import TestUtils (ghcGoldenDir, parseObject, testGoldenIO, testParseError) +import TestUtils (ghcGoldenDir, ghcVersion, parseObject, testGoldenIO, testParseError) import Tests.GetQQ.TH mkEnum "Greeting" ["HELLO", "GOODBYE"] @@ -402,7 +403,15 @@ testCompileTimeErrors = where testDir = "test/wont-compile/" getCompileError fp = do - (code, stdout, stderr) <- readProcessWithExitCode "ghc" [fp] "" + let args = + concat + [ [fp] + , -- https://gitlab.haskell.org/ghc/ghc/-/issues/25602 + if ghcVersion < makeVersion [9, 10] + then [] + else ["-package", "ghc-internal"] + ] + (code, stdout, stderr) <- readProcessWithExitCode "ghc" args "" case code of ExitFailure _ -> pure stderr ExitSuccess ->