2015-11-18 02:14:57 +03:00
|
|
|
module Operation where
|
|
|
|
|
|
|
|
import Diff
|
2016-01-06 19:56:58 +03:00
|
|
|
import Data.OrderedMap
|
2015-12-15 21:29:58 +03:00
|
|
|
import qualified Data.Text as T
|
2015-11-18 22:28:16 +03:00
|
|
|
import Term
|
2015-11-18 02:14:57 +03:00
|
|
|
|
2016-02-03 18:28:50 +03:00
|
|
|
-- | A single step in a diffing algorithm.
|
|
|
|
data Operation
|
|
|
|
a -- ^ The type of leaves in the syntax tree, typically String, but possibly some datatype representing different leaves more precisely.
|
|
|
|
annotation -- ^ The type of annotations.
|
|
|
|
f -- ^ The type representing another level of the diffing algorithm. Often Algorithm.
|
|
|
|
=
|
|
|
|
-- | Recursively diff two terms and pass the result to the continuation.
|
|
|
|
Recursive (Term a annotation) (Term a annotation) (Diff a annotation -> f)
|
|
|
|
-- | Diff two dictionaries and pass the result to the continuation.
|
2015-12-15 21:29:58 +03:00
|
|
|
| ByKey (OrderedMap T.Text (Term a annotation)) (OrderedMap T.Text (Term a annotation)) (OrderedMap T.Text (Diff a annotation) -> f)
|
2016-02-03 18:28:50 +03:00
|
|
|
-- | Diff two arrays and pass the result to the continuation.
|
2015-11-19 00:23:47 +03:00
|
|
|
| ByIndex [Term a annotation] [Term a annotation] ([Diff a annotation] -> f)
|
2015-11-18 02:39:51 +03:00
|
|
|
deriving Functor
|