From 15460768bd1dea7d1ce4059758a0cae3f0d0c29d Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 4 Aug 2016 11:48:28 -0400 Subject: [PATCH] =?UTF-8?q?Diff=20switch=20statements=E2=80=99=20cases=20b?= =?UTF-8?q?yIndex.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Interpreter.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Interpreter.hs b/src/Interpreter.hs index 092b80c54..16b0e043b 100644 --- a/src/Interpreter.hs +++ b/src/Interpreter.hs @@ -15,7 +15,7 @@ import Info import Patch import Prologue hiding (lookup) import SES -import Syntax +import Syntax as S import Term -- | Returns whether two terms are comparable @@ -41,6 +41,9 @@ diffComparableTerms construct comparable cost = recur algorithmWithTerms :: (TermF leaf (Both a) diff -> diff) -> Term leaf a -> Term leaf a -> Algorithm (Term leaf a) diff diff algorithmWithTerms construct t1 t2 = case (unwrap t1, unwrap t2) of (Indexed a, Indexed b) -> byIndex Indexed a b + (S.Switch exprA casesA, S.Switch exprB casesB) -> do + expr <- recursively exprA exprB + byIndex (S.Switch expr) casesA casesB (Commented commentsA a, Commented commentsB b) -> do wrapped <- sequenceA (recursively <$> a <*> b) byIndex (`Commented` wrapped) commentsA commentsB