summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomasSutton <>2020-05-22 10:56:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2020-05-22 10:56:00 (GMT)
commit13e0b9533f69535868405843386efb01434db825 (patch)
tree51db6375259c16448466616fe2c403becfe55a27
parenta395d13b1d79ae9cc376a564b5ee07a217adbd62 (diff)
version 1.1.0.9HEAD1.1.0.9master
-rw-r--r--aeson-diff.cabal4
-rw-r--r--lib/Data/Aeson/Patch.hs6
-rw-r--r--lib/Data/Aeson/Pointer.hs6
3 files changed, 10 insertions, 6 deletions
diff --git a/aeson-diff.cabal b/aeson-diff.cabal
index e7ffa49..a25f121 100644
--- a/aeson-diff.cabal
+++ b/aeson-diff.cabal
@@ -1,5 +1,5 @@
name: aeson-diff
-version: 1.1.0.8
+version: 1.1.0.9
synopsis: Extract and apply patches to JSON documents.
description:
.
@@ -34,7 +34,7 @@ library
exposed-modules: Data.Aeson.Diff
, Data.Aeson.Patch
, Data.Aeson.Pointer
- build-depends: base >=4.9 && <4.14
+ build-depends: base >=4.9 && <4.15
, aeson
, bytestring >= 0.10
, edit-distance-vector
diff --git a/lib/Data/Aeson/Patch.hs b/lib/Data/Aeson/Patch.hs
index 5907a95..b7efa81 100644
--- a/lib/Data/Aeson/Patch.hs
+++ b/lib/Data/Aeson/Patch.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
@@ -26,6 +27,7 @@ import Data.Monoid
import Data.Semigroup (Semigroup)
import Data.Vector (Vector)
import qualified Data.Vector as V
+import GHC.Generics (Generic)
import Data.Aeson.Pointer
@@ -34,7 +36,7 @@ import Data.Aeson.Pointer
-- | Describes the changes between two JSON documents.
newtype Patch = Patch
{ patchOperations :: [Operation] }
- deriving (Eq, Show, Semigroup, Monoid)
+ deriving (Eq, Show, Semigroup, Monoid, Generic)
instance ToJSON Patch where
toJSON (Patch ops) = toJSON ops
@@ -70,7 +72,7 @@ data Operation
-- ^ http://tools.ietf.org/html/rfc6902#section-4.3
| Tst { changePointer :: Pointer, changeValue :: Value }
-- ^ http://tools.ietf.org/html/rfc6902#section-4.6
- deriving (Eq, Show)
+ deriving (Eq, Show, Generic)
instance ToJSON Operation where
toJSON (Add p v) = object
diff --git a/lib/Data/Aeson/Pointer.hs b/lib/Data/Aeson/Pointer.hs
index 7b7ec80..6e54758 100644
--- a/lib/Data/Aeson/Pointer.hs
+++ b/lib/Data/Aeson/Pointer.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
-- | Description: JSON Pointers as described in RFC 6901.
@@ -25,6 +26,7 @@ import Data.Semigroup (Semigroup)
import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.Vector as V
+import GHC.Generics (Generic)
-- * Patch components
@@ -32,7 +34,7 @@ import qualified Data.Vector as V
data Key
= OKey Text -- ^ Traverse a 'Value' with an 'Object' constructor.
| AKey Int -- ^ Traverse a 'Value' with an 'Array' constructor.
- deriving (Eq, Ord, Show)
+ deriving (Eq, Ord, Show, Generic)
instance ToJSON Key where
toJSON (OKey t) = String t
@@ -64,7 +66,7 @@ type Path = [Key]
--
-- Defined in RFC 6901 <http://tools.ietf.org/html/rfc6901>
newtype Pointer = Pointer { pointerPath :: Path }
- deriving (Eq, Ord, Show, Semigroup, Monoid)
+ deriving (Eq, Ord, Show, Semigroup, Monoid, Generic)
-- | Format a 'Pointer' as described in RFC 6901.
--