From 7fb10c67f495271e62671077677c426d2587eb87 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Sun, 24 Sep 2023 13:26:22 +0200 Subject: [PATCH] Support Aeson 2.2 (#2578) (#2581) Co-authored-by: Vekhir <134215107+Vekhir@users.noreply.github.com> Co-authored-by: Peter Lebbing --- .ci/bindist/linux/debian/focal/buildinfo.json | 4 ++++ .ci/stack-8.10.yaml | 1 + .ci/stack-8.6.yaml | 1 + .ci/stack-8.8.yaml | 1 + .ci/stack-9.0.yaml | 1 + cabal.project | 2 +- clash-lib/clash-lib.cabal | 5 ++++- clash-lib/src/Data/Aeson/Extra.hs | 3 ++- nix/nixpkgs.nix | 3 +++ nix/sources.json | 7 +++++++ stack.yaml | 1 + 11 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.ci/bindist/linux/debian/focal/buildinfo.json b/.ci/bindist/linux/debian/focal/buildinfo.json index 70e7a6c340..d3f7ad3e25 100644 --- a/.ci/bindist/linux/debian/focal/buildinfo.json +++ b/.ci/bindist/linux/debian/focal/buildinfo.json @@ -54,6 +54,10 @@ "name": "concurrent-supply", "src": {"type": "hackage", "version": "0.1.8"} }, + { + "name": "attoparsec-aeson", + "src": {"type": "hackage", "version": "2.1.0.0"} + }, { "name": "clash-prelude", "cabal_debian_options": [ diff --git a/.ci/stack-8.10.yaml b/.ci/stack-8.10.yaml index 2d7b102a02..840f10b035 100644 --- a/.ci/stack-8.10.yaml +++ b/.ci/stack-8.10.yaml @@ -13,3 +13,4 @@ extra-deps: - doctest-parallel-0.2.1@sha256:c6c0d095dd6e0b8ce1bd9f6f5fc4e0cf5cf50b6895b557356ac41b8aa2947399,5631 - fakedata-1.0.2@sha256:37c93be9a81acbc9109e2c0b300a793d9c1f5ead1d34330d869d76568191f428,24593 - tasty-1.2.3@sha256:bba67074e5326d57e8f53fc1dabcb6841daa4dc51b053506eb7f40a6f49a0497,2517 +- attoparsec-aeson-2.1.0.0@sha256:fa83aba43bfa58490de8f274d19b9d58b6403a207b12cac5f93922102b084c52,1154 diff --git a/.ci/stack-8.6.yaml b/.ci/stack-8.6.yaml index bc03808b6e..2cf0d9667b 100644 --- a/.ci/stack-8.6.yaml +++ b/.ci/stack-8.6.yaml @@ -22,3 +22,4 @@ extra-deps: - fakedata-parser-0.1.0.0@sha256:6de870a2c21624aa4516f7ee28fc0076b3b19f3c32d23c969f8f0d7de47c606a,1362 - string-random-0.1.4.2@sha256:d34c614b63dbf928af428c1f2be033463c9bddfb286f3002657ef13336a2de32,2172 - lazysmallcheck-0.6@sha256:dac7a1e4877681f1260309e863e896674dd6efc1159897b7945893e693f2a6bc,1696 +- attoparsec-aeson-2.1.0.0@sha256:fa83aba43bfa58490de8f274d19b9d58b6403a207b12cac5f93922102b084c52,1154 diff --git a/.ci/stack-8.8.yaml b/.ci/stack-8.8.yaml index 90305fd514..ae3267ef04 100644 --- a/.ci/stack-8.8.yaml +++ b/.ci/stack-8.8.yaml @@ -19,3 +19,4 @@ extra-deps: - fakedata-parser-0.1.0.0@sha256:6de870a2c21624aa4516f7ee28fc0076b3b19f3c32d23c969f8f0d7de47c606a,1362 - string-random-0.1.4.2@sha256:d34c614b63dbf928af428c1f2be033463c9bddfb286f3002657ef13336a2de32,2172 - lazysmallcheck-0.6@sha256:dac7a1e4877681f1260309e863e896674dd6efc1159897b7945893e693f2a6bc,1696 +- attoparsec-aeson-2.1.0.0@sha256:fa83aba43bfa58490de8f274d19b9d58b6403a207b12cac5f93922102b084c52,1154 diff --git a/.ci/stack-9.0.yaml b/.ci/stack-9.0.yaml index 03b540a182..a8821275cc 100644 --- a/.ci/stack-9.0.yaml +++ b/.ci/stack-9.0.yaml @@ -11,3 +11,4 @@ packages: extra-deps: - tasty-1.2.3@sha256:bba67074e5326d57e8f53fc1dabcb6841daa4dc51b053506eb7f40a6f49a0497,2517 +- attoparsec-aeson-2.1.0.0@sha256:fa83aba43bfa58490de8f274d19b9d58b6403a207b12cac5f93922102b084c52,1154 diff --git a/cabal.project b/cabal.project index 04140c951e..4a4f645fc4 100644 --- a/cabal.project +++ b/cabal.project @@ -14,7 +14,7 @@ write-ghc-environment-files: always -- index state, to go along with the cabal.project.freeze file. update the index -- state by running `cabal update` twice and looking at the index state it -- displays to you (as the second update will be a no-op) -index-state: 2023-01-03T11:58:30Z +index-state: 2023-09-22T15:42:26Z -- For some reason the `clash-testsuite` executable fails to run without -- this, as it cannot find the related library... diff --git a/clash-lib/clash-lib.cabal b/clash-lib/clash-lib.cabal index 8bd2e56b02..fe11164e94 100644 --- a/clash-lib/clash-lib.cabal +++ b/clash-lib/clash-lib.cabal @@ -126,7 +126,8 @@ Library RecordWildCards TemplateHaskell - Build-depends: aeson >= 0.6.2.0 && < 2.2, + Build-depends: aeson >= 0.6.2.0 && < 2.3, + attoparsec-aeson >= 2.1 && < 2.3, aeson-pretty >= 0.8 && < 0.9, ansi-terminal >= 0.8.0.0 && < 0.12, array, @@ -307,6 +308,7 @@ executable v16-upgrade-primitives Build-Depends: base, aeson, + attoparsec-aeson, deepseq, yaml, bytestring, @@ -336,6 +338,7 @@ test-suite unittests ghc-typelits-knownnat, aeson, + attoparsec-aeson, aeson-pretty, base, base16-bytestring, diff --git a/clash-lib/src/Data/Aeson/Extra.hs b/clash-lib/src/Data/Aeson/Extra.hs index 1c1b2788aa..fc87d9b169 100644 --- a/clash-lib/src/Data/Aeson/Extra.hs +++ b/clash-lib/src/Data/Aeson/Extra.hs @@ -24,7 +24,8 @@ import Data.Text.Encoding.Error (UnicodeException(..)) import Data.List (intercalate) import Data.List.Extra (groupOn) import Data.Tuple.Extra (second, first) -import Data.Aeson (FromJSON, Result (..), fromJSON, json) +import Data.Aeson (FromJSON, Result (..), fromJSON) +import Data.Aeson.Parser (json) import Data.Attoparsec.Lazy (Result (..), parse) import Data.ByteString.Lazy (ByteString) import qualified Data.ByteString.Lazy as BS diff --git a/nix/nixpkgs.nix b/nix/nixpkgs.nix index b8566e9f74..18fc8417e1 100644 --- a/nix/nixpkgs.nix +++ b/nix/nixpkgs.nix @@ -32,6 +32,9 @@ let doctest-parallel = self.callCabal2nix "doctest-parallel" sources.doctest-parallel {}; + attoparsec-aeson = + self.callCabal2nix "attoparsec-aeson" sources.attoparsec-aeson {}; + # Internal overrides clash-lib = import ../clash-lib { inherit nixpkgs; }; clash-ghc = import ../clash-ghc { inherit nixpkgs; }; diff --git a/nix/sources.json b/nix/sources.json index 3f0ae09cb1..cc6995a945 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -1,4 +1,11 @@ { + "attoparsec-aeson": { + "sha256": "068d77pb3kbnqp2x7qgqmlcw5d93hna5px8vsdg8np9ngwq1bp72", + "type": "tarball", + "url": "https://hackage.haskell.org/package/attoparsec-aeson-2.1.0.0/attoparsec-aeson-2.1.0.0.tar.gz", + "url_template": "https://hackage.haskell.org/package/attoparsec-aeson-/attoparsec-aeson-.tar.gz", + "version": "2.1.0.0" + }, "doctest-parallel": { "branch": "main", "description": "Test interactive Haskell examples", diff --git a/stack.yaml b/stack.yaml index 4bc94c008f..2c41eea0be 100644 --- a/stack.yaml +++ b/stack.yaml @@ -9,3 +9,4 @@ packages: extra-deps: - ./clash-cosim +- attoparsec-aeson-2.1.0.0@sha256:fa83aba43bfa58490de8f274d19b9d58b6403a207b12cac5f93922102b084c52,1154