Skip to content

Commit b52e1e5

Browse files
authored
Merge pull request #57 from haskellari/aeson-2
Support aeson-2.0.0.0
2 parents 06cf1b0 + e454482 commit b52e1e5

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.2.1
2+
3+
- Support `aeson-2.0.0.0`
4+
15
## 0.2
26

37
- Change the pretty printing to use less horizontal space.

src/Data/TreeDiff/Class.hs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ import Data.Foldable (toList)
2424
import Data.List.Compat (uncons)
2525
import Data.Proxy (Proxy (..))
2626
import GHC.Generics
27-
((:*:) (..), (:+:) (..), Constructor (..), Generic (..), K1 (..),
28-
M1 (..), Selector (..), U1 (..), V1)
27+
(Constructor (..), Generic (..), K1 (..), M1 (..), Selector (..),
28+
U1 (..), V1, (:*:) (..), (:+:) (..))
2929

30-
import qualified Data.Map as Map
30+
import qualified Data.Map as Map
3131
import qualified Data.TreeDiff.OMap as OMap
3232

3333
import Data.TreeDiff.Expr
@@ -94,6 +94,10 @@ import qualified Data.HashSet as HS
9494

9595
-- aeson
9696
import qualified Data.Aeson as Aeson
97+
#if MIN_VERSION_aeson(2,0,0)
98+
import qualified Data.Aeson.Key as Key
99+
import qualified Data.Aeson.KeyMap as KM
100+
#endif
97101

98102
-- strict
99103
import qualified Data.Strict as Strict
@@ -550,6 +554,14 @@ instance (ToExpr k) => ToExpr (HS.HashSet k) where
550554

551555
instance ToExpr Aeson.Value
552556

557+
#if MIN_VERSION_aeson(2,0,0)
558+
instance ToExpr Key.Key where
559+
toExpr = stringToExpr "Key.concat" . unconcat T.uncons . Key.toText
560+
561+
instance ToExpr a => ToExpr (KM.KeyMap a) where
562+
toExpr x = App "KM.fromList" [ toExpr $ KM.toList x ]
563+
#endif
564+
553565
-------------------------------------------------------------------------------
554566
-- strict
555567
-------------------------------------------------------------------------------

tree-diff.cabal

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
cabal-version: 2.2
22
name: tree-diff
3-
version: 0.2
4-
x-revision: 1
3+
version: 0.2.1
54
synopsis: Diffing of (expression) trees.
65
category: Data, Testing
76
description:
@@ -94,7 +93,7 @@ library
9493
, time ^>=1.4 || ^>=1.5.0.1 || ^>=1.6.0.1 || ^>=1.8.0.2 || ^>=1.9.3
9594

9695
build-depends:
97-
, aeson ^>=1.4.6.0 || ^>=1.5.6.0
96+
, aeson ^>=1.4.6.0 || ^>=1.5.6.0 || ^>=2.0.0.0
9897
, ansi-terminal >=0.10 && <0.12
9998
, ansi-wl-pprint ^>=0.6.8.2
10099
, base-compat ^>=0.10.5 || ^>=0.11.0 || ^>=0.12

0 commit comments

Comments
 (0)