diff --git a/src/Algorithm.hs b/src/Algorithm.hs index 18c9a3037..8208dae30 100644 --- a/src/Algorithm.hs +++ b/src/Algorithm.hs @@ -87,7 +87,7 @@ instance Show term => Show1 (AlgorithmF term diff) where -- | Diff two terms based on their generic Diffable instances. If the terms are not diffable -- (represented by a Nothing diff returned from algorithmFor) replace one term with another. algorithmForTerms :: (Functor f, Diffable f) => Term f a -> Term f a -> Algorithm (Term f a) (Diff f a) (Diff f a) -algorithmForTerms t1@(Term (ann1 :< f1)) t2@(Term (ann2 :< f2)) = fromMaybe (byReplacing t1 t2) (fmap (Diff.Diff . Copy (both ann1 ann2)) <$> algorithmFor f1 f2) +algorithmForTerms t1@(Term (ann1 :< f1)) t2@(Term (ann2 :< f2)) = fromMaybe (byReplacing t1 t2) (fmap (copy (both ann1 ann2)) <$> algorithmFor f1 f2) -- | A type class for determining what algorithm to use for diffing two terms. diff --git a/src/Interpreter.hs b/src/Interpreter.hs index 5667f3246..c35c55af1 100644 --- a/src/Interpreter.hs +++ b/src/Interpreter.hs @@ -49,7 +49,7 @@ diffTermsWith refine comparable (Join (a, b)) = runFreer decompose (diff a b) decompose step = case step of Algorithm.Diff t1 t2 -> refine t1 t2 Linear t1 t2 -> case galignWith diffThese (unwrap t1) (unwrap t2) of - Just result -> Diff.Diff . Copy (both (extract t1) (extract t2)) <$> sequenceA result + Just result -> copy (both (extract t1) (extract t2)) <$> sequenceA result _ -> byReplacing t1 t2 RWS as bs -> traverse diffThese (rws (editDistanceUpTo defaultM) comparable as bs) Delete a -> pure (deleting a) @@ -104,7 +104,7 @@ algorithmWithTerms t1 t2 = case (unwrap t1, unwrap t2) of <*> byRWS bodyA bodyB _ -> linearly t1 t2 where - annotate = Diff.Diff . Copy (both (extract t1) (extract t2)) + annotate = copy (both (extract t1) (extract t2)) -- | Test whether two terms are comparable by their Category. @@ -129,4 +129,4 @@ editDistanceUpTo m = these termSize termSize (\ a b -> diffCost m (approximateDi | otherwise = case diff of Copy _ r -> sum (fmap (diffCost (pred m)) r) Patch patch -> patchSum termSize patch - approximateDiff a b = maybe (replacing a b) (Diff.Diff . Copy (both (extract a) (extract b))) (galignWith (these deleting inserting approximateDiff) (unwrap a) (unwrap b)) + approximateDiff a b = maybe (replacing a b) (copy (both (extract a) (extract b))) (galignWith (these deleting inserting approximateDiff) (unwrap a) (unwrap b))