diff --git a/clash-lib/clash-lib.cabal b/clash-lib/clash-lib.cabal index 789e682724..9159a3b849 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, @@ -331,6 +332,7 @@ executable v16-upgrade-primitives Build-Depends: base, aeson, + attoparsec-aeson, deepseq, yaml, bytestring, @@ -392,6 +394,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 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