Skip to content

Commit

Permalink
renaming (diff3 to merge; preprocess to decorate)
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorCMiraldo committed Apr 16, 2020
1 parent 75934d6 commit f44e8a0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion executable/HDiff.hs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ mainMerge v sel opts = withParsed3 sel mainParsers (optFileA opts) (optFileO opt
$ \pp fa fo fb -> do
patchOA <- diffWithOpts opts fo fa
patchOB <- diffWithOpts opts fo fb
let momc = D.diff3 patchOA patchOB
let momc = D.merge patchOA patchOB
case momc of
Nothing -> return (ExitFailure 13)
Just omc -> case D.noConflicts omc of
Expand Down
4 changes: 2 additions & 2 deletions src/Data/HDiff/Diff.hs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ diffOpts' :: forall kappa fam at
-> SFix kappa fam at
-> (Int , Delta (Holes kappa fam (MetaVar kappa fam)) at)
diffOpts' opts x y
= let dx = preprocess x
dy = preprocess y
= let dx = decorate x
dy = decorate y
(i, sh) = buildSharingTrie opts dx dy
delins = extractHoles (doMode opts) mkCanShare sh (dx :*: dy)
in (i , delins)
Expand Down
10 changes: 5 additions & 5 deletions src/Data/HDiff/Diff/Preprocess.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ type PrepFix a kappa fam

-- |Here we receive an expression with holes an annotate
-- it with hashes and height information at every node.
preprocess :: forall kappa fam at
. (All Digestible kappa)
=> SFix kappa fam at
-> PrepFix () kappa fam at
preprocess = synthesize (const onRec) (const onPrim) (const botElim)
decorate :: forall kappa fam at
. (All Digestible kappa)
=> SFix kappa fam at
-> PrepFix () kappa fam at
decorate = synthesize (const onRec) (const onPrim) (const botElim)
where
botElim :: V1 x -> a
botElim = error "botElim"
Expand Down
10 changes: 5 additions & 5 deletions src/Data/HDiff/Merge.hs
Original file line number Diff line number Diff line change
Expand Up @@ -171,18 +171,18 @@ getConflicts = foldr act [] . holesHolesList
act (Exists (InR _)) = id
act (Exists (InL c)) = (Exists c :)

-- * Diff3
-- * Merge
--
-- $diff3
-- $merge

-- |@diff3 p q@ omputes a patch that attempts to reconcile
-- |@merge p q@ omputes a patch that attempts to reconcile
-- the differences from @p@ and @q@ into a single patch.
-- In the locations where this is not possible, we
-- place a conflict.
diff3 :: (All Show kappa , All Eq kappa)
merge :: (All Show kappa , All Eq kappa)
=> Patch kappa fam ix -> Patch kappa fam ix
-> Maybe (PatchC kappa fam ix)
diff3 oa ob =
merge oa ob =
-- The first step is computing an alignment of
-- oa; yet, we must care for the variables introduced
-- by it; note how we align a /shifted/ version of ob
Expand Down
2 changes: 1 addition & 1 deletion tests/Data/HDiff/MergeSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ doMerge mode a o b
-- we get a different result altogether.
oa = hdiffRTreeHM mode 1 o a
ob = hdiffRTreeHM mode 1 o b
in case diff3 oa ob of
in case merge oa ob of
Nothing -> PrecondFail -- patches are not a span
Just p -> case noConflicts p of
Just oc -> case applyRTree oc o of
Expand Down

0 comments on commit f44e8a0

Please sign in to comment.