Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.Aeson.Diff
Description
This module implements data types and operations to represent the differences between JSON documents (i.e. a patch), to compare JSON documents and extract such a patch, and to apply such a patch to a JSON document.
Synopsis
- newtype Patch = Patch [Operation]
- data Pointer
- data Key
- data Operation
- newtype Config = Config {}
- diff :: Value -> Value -> Patch
- diff' :: Config -> Value -> Value -> Patch
- patch :: Patch -> Value -> Result Value
- applyOperation :: Operation -> Value -> Result Value
Patches
Describes the changes between two JSON documents.
Instances
FromJSON Patch Source # | |||||
Defined in Data.Aeson.Patch | |||||
ToJSON Patch Source # | |||||
Monoid Patch Source # | |||||
Semigroup Patch Source # | |||||
Generic Patch Source # | |||||
Defined in Data.Aeson.Patch Associated Types
| |||||
Show Patch Source # | |||||
Eq Patch Source # | |||||
type Rep Patch Source # | |||||
Defined in Data.Aeson.Patch |
Pointer to a location in a JSON document.
Defined in RFC 6901 http://tools.ietf.org/html/rfc6901
Instances
FromJSON Pointer Source # | |||||
Defined in Data.Aeson.Pointer | |||||
ToJSON Pointer Source # | |||||
Monoid Pointer Source # | |||||
Semigroup Pointer Source # | |||||
Generic Pointer Source # | |||||
Defined in Data.Aeson.Pointer Associated Types
| |||||
Show Pointer Source # | |||||
Eq Pointer Source # | |||||
Ord Pointer Source # | |||||
type Rep Pointer Source # | |||||
Defined in Data.Aeson.Pointer |
Path components to traverse a single layer of a JSON document.
Instances
An Operation
describes the operations which can appear as part of a JSON
Patch.
See RFC 6902 Section 4 http://tools.ietf.org/html/rfc6902#section-4.
Constructors
Add | http://tools.ietf.org/html/rfc6902#section-4.1 |
Fields
| |
Cpy Pointer Pointer | http://tools.ietf.org/html/rfc6902#section-4.5 |
Mov Pointer Pointer | http://tools.ietf.org/html/rfc6902#section-4.4 |
Rem | http://tools.ietf.org/html/rfc6902#section-4.2 |
Fields | |
Rep | http://tools.ietf.org/html/rfc6902#section-4.3 |
Fields
| |
Tst | http://tools.ietf.org/html/rfc6902#section-4.6 |
Fields
|
Instances
FromJSON Operation Source # | |||||
Defined in Data.Aeson.Patch | |||||
ToJSON Operation Source # | |||||
Generic Operation Source # | |||||
Defined in Data.Aeson.Patch Associated Types
| |||||
Show Operation Source # | |||||
Eq Operation Source # | |||||
type Rep Operation Source # | |||||
Defined in Data.Aeson.Patch type Rep Operation = D1 ('MetaData "Operation" "Data.Aeson.Patch" "aeson-diff-1.1.0.13-4Ya90qLVgTyEUPMnzN8rMx" 'False) ((C1 ('MetaCons "Add" 'PrefixI 'True) (S1 ('MetaSel ('Just "changePointer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Pointer) :*: S1 ('MetaSel ('Just "changeValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value)) :+: (C1 ('MetaCons "Cpy" 'PrefixI 'True) (S1 ('MetaSel ('Just "changePointer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Pointer) :*: S1 ('MetaSel ('Just "fromPointer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Pointer)) :+: C1 ('MetaCons "Mov" 'PrefixI 'True) (S1 ('MetaSel ('Just "changePointer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Pointer) :*: S1 ('MetaSel ('Just "fromPointer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Pointer)))) :+: (C1 ('MetaCons "Rem" 'PrefixI 'True) (S1 ('MetaSel ('Just "changePointer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Pointer)) :+: (C1 ('MetaCons "Rep" 'PrefixI 'True) (S1 ('MetaSel ('Just "changePointer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Pointer) :*: S1 ('MetaSel ('Just "changeValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value)) :+: C1 ('MetaCons "Tst" 'PrefixI 'True) (S1 ('MetaSel ('Just "changePointer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Pointer) :*: S1 ('MetaSel ('Just "changeValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value))))) |
Configuration for the diff algorithm.
Constructors
Config | |
Fields |
Functions
diff :: Value -> Value -> Patch Source #
Compare two JSON documents and generate a patch describing the differences.
Uses the defaultConfig
.