diff --git a/src/Operation.hs b/src/Operation.hs index 57b8fde59..bccbbb8bf 100644 --- a/src/Operation.hs +++ b/src/Operation.hs @@ -5,8 +5,16 @@ import Data.OrderedMap import qualified Data.Text as T import Term -data Operation a annotation f - = Recursive (Term a annotation) (Term a annotation) (Diff a annotation -> f) +-- | 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. | ByKey (OrderedMap T.Text (Term a annotation)) (OrderedMap T.Text (Term a annotation)) (OrderedMap T.Text (Diff a annotation) -> f) + -- | Diff two arrays and pass the result to the continuation. | ByIndex [Term a annotation] [Term a annotation] ([Diff a annotation] -> f) deriving Functor