From 40fe88b4a45d17dbe0c41f85288177a9f2f38e89 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 22 Oct 2015 10:46:51 -0400 Subject: [PATCH] Rename the Syntax piecewise equality functions after the type parameters (mostly). --- prototype/Doubt/Cofree.swift | 2 +- prototype/Doubt/Free.swift | 2 +- prototype/Doubt/Syntax.swift | 10 +++++----- prototype/Doubt/TermType.swift | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/prototype/Doubt/Cofree.swift b/prototype/Doubt/Cofree.swift index 1577e3915..437a4f8dc 100644 --- a/prototype/Doubt/Cofree.swift +++ b/prototype/Doubt/Cofree.swift @@ -76,7 +76,7 @@ extension Cofree { extension Cofree { public static func equals(annotation annotation: (Annotation, Annotation) -> Bool, leaf: (Leaf, Leaf) -> Bool)(_ left: Cofree, _ right: Cofree) -> Bool { return annotation(left.extract, right.extract) - && Syntax.equals(ifLeaf: leaf, ifRecur: Cofree.equals(annotation: annotation, leaf: leaf))(left.unwrap, right.unwrap) + && Syntax.equals(leaf: leaf, recur: Cofree.equals(annotation: annotation, leaf: leaf))(left.unwrap, right.unwrap) } } diff --git a/prototype/Doubt/Free.swift b/prototype/Doubt/Free.swift index 9dd2be29f..aa08848d7 100644 --- a/prototype/Doubt/Free.swift +++ b/prototype/Doubt/Free.swift @@ -170,7 +170,7 @@ extension Free { case let (.Pure(a), .Pure(b)): return pure(a, b) case let (.Roll(a), .Roll(b)): - return Syntax.equals(ifLeaf: leaf, ifRecur: equals(pure: pure, leaf: leaf))(a, b) + return Syntax.equals(leaf: leaf, recur: equals(pure: pure, leaf: leaf))(a, b) default: return false } diff --git a/prototype/Doubt/Syntax.swift b/prototype/Doubt/Syntax.swift index f89db37c9..e2d9e4f7b 100644 --- a/prototype/Doubt/Syntax.swift +++ b/prototype/Doubt/Syntax.swift @@ -52,14 +52,14 @@ extension Syntax: DictionaryLiteralConvertible { // MARK: - Equality extension Syntax { - public static func equals(ifLeaf ifLeaf: (A, A) -> Bool, ifRecur: (Recur, Recur) -> Bool)(_ left: Syntax, _ right: Syntax) -> Bool { + public static func equals(leaf leaf: (A, A) -> Bool, recur: (Recur, Recur) -> Bool)(_ left: Syntax, _ right: Syntax) -> Bool { switch (left, right) { case let (.Leaf(l1), .Leaf(l2)): - return ifLeaf(l1, l2) + return leaf(l1, l2) case let (.Indexed(v1), .Indexed(v2)): - return v1.count == v2.count && zip(v1, v2).lazy.map(ifRecur).reduce(true) { $0 && $1 } + return v1.count == v2.count && zip(v1, v2).lazy.map(recur).reduce(true) { $0 && $1 } case let (.Keyed(d1), .Keyed(d2)): - return Set(d1.keys) == Set(d2.keys) && d1.keys.map { ifRecur(d1[$0]!, d2[$0]!) }.reduce(true) { $0 && $1 } + return Set(d1.keys) == Set(d2.keys) && d1.keys.map { recur(d1[$0]!, d2[$0]!) }.reduce(true) { $0 && $1 } default: return false } @@ -67,7 +67,7 @@ extension Syntax { } public func == (left: Syntax, right: Syntax) -> Bool { - return Syntax.equals(ifLeaf: ==, ifRecur: ==)(left, right) + return Syntax.equals(leaf: ==, recur: ==)(left, right) } diff --git a/prototype/Doubt/TermType.swift b/prototype/Doubt/TermType.swift index 4ecb857a5..ff651ba8d 100644 --- a/prototype/Doubt/TermType.swift +++ b/prototype/Doubt/TermType.swift @@ -44,7 +44,7 @@ extension TermType { extension TermType { public static func equals(leaf: (Leaf, Leaf) -> Bool)(_ a: Self, _ b: Self) -> Bool { - return Syntax.equals(ifLeaf: leaf, ifRecur: equals(leaf))(a.unwrap, b.unwrap) + return Syntax.equals(leaf: leaf, recur: equals(leaf))(a.unwrap, b.unwrap) } }