From bf9aca0fa8406dc0e8df663bc83f7b62428d697b Mon Sep 17 00:00:00 2001 From: Vekhir Date: Thu, 14 Sep 2023 08:52:01 +0200 Subject: [PATCH] Support Aeson 2.2 --- clash-lib/clash-lib.cabal | 3 ++- clash-lib/src/Data/Aeson/Extra.hs | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/clash-lib/clash-lib.cabal b/clash-lib/clash-lib.cabal index 789e682724..6e837cf100 100644 --- a/clash-lib/clash-lib.cabal +++ b/clash-lib/clash-lib.cabal @@ -134,7 +134,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 && < 1.1, array, diff --git a/clash-lib/src/Data/Aeson/Extra.hs b/clash-lib/src/Data/Aeson/Extra.hs index cf53fba75e..2c8e1a3e60 100644 --- a/clash-lib/src/Data/Aeson/Extra.hs +++ b/clash-lib/src/Data/Aeson/Extra.hs @@ -25,7 +25,12 @@ import Data.List (intercalate) import Data.List.NonEmpty (NonEmpty (..)) import qualified Data.List.NonEmpty as NE import Data.Tuple.Extra (second, first) +#if MIN_VERSION_aeson(2,2,0) +import Data.Aeson (FromJSON, Result (..), fromJSON) +import Data.Aeson.Parser (json) +#else import Data.Aeson (FromJSON, Result (..), fromJSON, json) +#endif import Data.Attoparsec.Lazy (Result (..), parse) import Data.ByteString.Lazy (ByteString) import qualified Data.ByteString.Lazy as BS