From 84fc0a54a908c4ca7b8c1e06263f21db48eedc84 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 4 Apr 2016 17:20:21 -0400 Subject: [PATCH] Implement alignPatch over Delete/Insert. --- src/Alignment.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Alignment.hs b/src/Alignment.hs index 841e29449..3d26a4937 100644 --- a/src/Alignment.hs +++ b/src/Alignment.hs @@ -114,10 +114,9 @@ type Row a = Both (Line a) type AlignedDiff leaf = [Join These (SplitDiff leaf Info)] alignPatch :: Both (Source Char) -> Patch (Term leaf Info) -> AlignedDiff leaf +alignPatch sources (Delete term) = hylo (alignSyntax (Join . This . runIdentity) (Identity $ fst sources)) unCofree (Identity <$> term) +alignPatch sources (Insert term) = hylo (alignSyntax (Join . That . runIdentity) (Identity $ snd sources)) unCofree (Identity <$> term) alignPatch _ _ = [] --- alignPatch sources patch = crosswalk (hylo (alignTerm sources) unCofree) (unPatch patch) --- alignPatch sources (Insert term) = hylo (alignTerm sources) unCofree term --- alignPatch sources (Delete term) = hylo (alignTerm sources) unCofree term -- alignPatch sources (Replace term1 term2) = alignWith Join (hylo (alignTerm sources) unCofree term1) -- (hylo (alignTerm sources) unCofree term2) --