From 02e836d364351c518ed4f892ab21a9a48ccf5e72 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 14 Jul 2016 11:27:54 -0400 Subject: [PATCH] Equate terms with respect to their categories. --- src/Interpreter.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Interpreter.hs b/src/Interpreter.hs index 6f5d61c93..ed68f3df1 100644 --- a/src/Interpreter.hs +++ b/src/Interpreter.hs @@ -32,7 +32,7 @@ diffTerms construct comparable cost a b = fromMaybe (pure $ Replace a b) $ const constructAndRun :: (Eq leaf, Hashable leaf, Ord (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)) constructAndRun construct comparable cost t1 t2 | not $ comparable t1 t2 = Nothing - | (() <$ t1) == (() <$ t2) = hylo construct runCofree <$> zipTerms t1 t2 + | (category <$> t1) == (category <$> t2) = hylo construct runCofree <$> zipTerms t1 t2 | otherwise = run construct comparable cost $ algorithm a b where algorithm (Indexed a') (Indexed b') = wrap $! ByIndex a' b' (annotate . Indexed)