From fb247732ccd952d2abe627b741171b49f3702338 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 1 Oct 2015 11:34:17 -0400 Subject: [PATCH] Move diff equality into Diff.swift. --- prototype/Doubt/Diff.swift | 12 ++++++++++++ prototype/Doubt/Equatable.swift | 11 ----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/prototype/Doubt/Diff.swift b/prototype/Doubt/Diff.swift index dc5a05ff8..adac9fd12 100644 --- a/prototype/Doubt/Diff.swift +++ b/prototype/Doubt/Diff.swift @@ -111,3 +111,15 @@ public enum Diff: Comparable, CustomDebugStringConvertible, CustomDocConvertible return Array(diff(Stream(sequence: a), Stream(sequence: b)).map { $0.0 }) } } + + +public func == (left: Diff, right: Diff) -> Bool { + switch (left, right) { + case let (.Patch(a1, b1), .Patch(a2, b2)): + return a1 == a2 && b1 == b2 + case let (.Copy(a), .Copy(b)): + return a == b + default: + return false + } +} diff --git a/prototype/Doubt/Equatable.swift b/prototype/Doubt/Equatable.swift index 6d2bec8bc..2fe22f9b8 100644 --- a/prototype/Doubt/Equatable.swift +++ b/prototype/Doubt/Equatable.swift @@ -19,17 +19,6 @@ public func == (left: Syntax, right: Syntax Bool { - switch (left, right) { - case let (.Patch(a1, b1), .Patch(a2, b2)): - return a1 == a2 && b1 == b2 - case let (.Copy(a), .Copy(b)): - return a == b - default: - return false - } -} - public func == (left: Doc, right: Doc) -> Bool { switch (left, right) { case (.Empty, .Empty), (.Line, .Line):