1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 16:33:03 +03:00

Document Operation.hs

This commit is contained in:
Matt Diephouse 2016-02-03 10:28:50 -05:00
parent 0ee81bd20f
commit 82b07ccd8b

View File

@ -5,8 +5,16 @@ import Data.OrderedMap
import qualified Data.Text as T import qualified Data.Text as T
import Term import Term
data Operation a annotation f -- | A single step in a diffing algorithm.
= Recursive (Term a annotation) (Term a annotation) (Diff a annotation -> f) 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) | 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) | ByIndex [Term a annotation] [Term a annotation] ([Diff a annotation] -> f)
deriving Functor deriving Functor