From 26b5f5b41bfcc3d8c17490b9b2bf1869d1058110 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 4 Aug 2016 12:48:27 -0400 Subject: [PATCH] :memo: diffComparableTerms. --- src/Interpreter.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Interpreter.hs b/src/Interpreter.hs index 4ef568168..3c15317c3 100644 --- a/src/Interpreter.hs +++ b/src/Interpreter.hs @@ -34,6 +34,7 @@ diffTerms :: (Eq leaf, Hashable leaf, Eq (Record fields), HasField fields Catego -> Diff leaf (Record fields) diffTerms construct comparable cost a b = fromMaybe (replacing a b) $ diffComparableTerms construct comparable cost a b +-- | Diff two terms recursively, given functions characterizing the diffing. If the terms are incomparable, returns 'Nothing'. diffComparableTerms :: (Eq leaf, Hashable leaf, Eq (Record fields), HasField fields Category) => DiffConstructor leaf (Record fields) -> Comparable leaf (Record fields) -> SES.Cost (Diff leaf (Record fields)) -> Term leaf (Record fields) -> Term leaf (Record fields) -> Maybe (Diff leaf (Record fields)) diffComparableTerms construct comparable cost = recur where recur a b