From c3f060d65b34221d83a1cefdb6ba590d38219354 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 12 Jul 2016 23:26:14 -0400 Subject: [PATCH] :fire: `ByKey` operations. --- src/Interpreter.hs | 4 ---- src/Operation.hs | 2 -- 2 files changed, 6 deletions(-) diff --git a/src/Interpreter.hs b/src/Interpreter.hs index d7f0c2727..6f5d61c93 100644 --- a/src/Interpreter.hs +++ b/src/Interpreter.hs @@ -2,7 +2,6 @@ module Interpreter (Comparable, DiffConstructor, diffTerms) where import Algorithm import Category -import Data.Align import Data.Align.Generic import Data.Functor.Foldable import Data.Functor.Both @@ -37,7 +36,6 @@ constructAndRun construct comparable cost t1 t2 | otherwise = run construct comparable cost $ algorithm a b where algorithm (Indexed a') (Indexed b') = wrap $! ByIndex a' b' (annotate . Indexed) - algorithm (Keyed a') (Keyed b') = wrap $! ByKey a' b' (annotate . Keyed) algorithm (Leaf a') (Leaf b') | a' == b' = annotate $ Leaf b' algorithm a' b' = wrap $! Recursive (cofree (annotation1 :< a')) (cofree (annotation2 :< b')) pure (annotation1 :< a, annotation2 :< b) = (runCofree t1, runCofree t2) @@ -55,8 +53,6 @@ run construct comparable cost algorithm = case runFree algorithm of diffThese = these (pure . Delete) (pure . Insert) (diffTerms construct comparable cost) - Free (ByKey a b f) -> run construct comparable cost $ f byKey where byKey = alignWith (these (pure . Delete) (pure . Insert) (diffTerms construct comparable cost)) a b - Free (ByIndex a b f) -> run construct comparable cost . f $ ses (constructAndRun construct comparable cost) cost a b Free (ByRandomWalkSimilarity a b f) -> run construct comparable cost . f $ rws (constructAndRun construct comparable cost) getLabel a b diff --git a/src/Operation.hs b/src/Operation.hs index b920748b6..a718e14ae 100644 --- a/src/Operation.hs +++ b/src/Operation.hs @@ -2,7 +2,6 @@ module Operation where import Prologue import Diff -import Data.OrderedMap import Term -- | A single step in a diffing algorithm. @@ -13,7 +12,6 @@ data Operation -- | Recursively diff two terms and pass the result to the continuation. = Recursive (Term a annotation) (Term a annotation) (Diff a annotation -> f) -- | Diff two dictionaries and pass the result to the continuation. - | ByKey (OrderedMap Text (Term a annotation)) (OrderedMap Text (Term a annotation)) (OrderedMap Text (Diff a annotation) -> f) -- | Diff two arrays and pass the result to the continuation. | ByIndex [Term a annotation] [Term a annotation] ([Diff a annotation] -> f) | ByRandomWalkSimilarity [Term a annotation] [Term a annotation] ([Diff a annotation] -> f)