From 1059a00db03d1b82c0dda877dbead22fea327af8 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 6 Oct 2015 19:20:16 -0400 Subject: [PATCH] :fire: AnyEquatable. --- prototype/Doubt.xcodeproj/project.pbxproj | 4 ---- prototype/Doubt/AnyEquatable.swift | 20 -------------------- 2 files changed, 24 deletions(-) delete mode 100644 prototype/Doubt/AnyEquatable.swift diff --git a/prototype/Doubt.xcodeproj/project.pbxproj b/prototype/Doubt.xcodeproj/project.pbxproj index 8fea1ae51..06f620667 100644 --- a/prototype/Doubt.xcodeproj/project.pbxproj +++ b/prototype/Doubt.xcodeproj/project.pbxproj @@ -22,7 +22,6 @@ D4413FF11BB08FDC00E3C3C1 /* JSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4413FF01BB08FDC00E3C3C1 /* JSON.swift */; }; D45A36C91BBC667D00BE3DDE /* Category.swift in Sources */ = {isa = PBXBuildFile; fileRef = D45A36C81BBC667D00BE3DDE /* Category.swift */; settings = {ASSET_TAGS = (); }; }; D45A36CD1BBC75DF00BE3DDE /* Info.swift in Sources */ = {isa = PBXBuildFile; fileRef = D45A36CC1BBC75DF00BE3DDE /* Info.swift */; settings = {ASSET_TAGS = (); }; }; - D49FCBAD1BBD7A3100C5E9C3 /* AnyEquatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D49FCBAC1BBD7A3100C5E9C3 /* AnyEquatable.swift */; settings = {ASSET_TAGS = (); }; }; D49FCBC21BBEF2C600C5E9C3 /* Fix.swift in Sources */ = {isa = PBXBuildFile; fileRef = D49FCBC11BBEF2C600C5E9C3 /* Fix.swift */; settings = {ASSET_TAGS = (); }; }; D49FCBC41BBEF98E00C5E9C3 /* Free.swift in Sources */ = {isa = PBXBuildFile; fileRef = D49FCBC31BBEF98E00C5E9C3 /* Free.swift */; settings = {ASSET_TAGS = (); }; }; D49FCBC61BBF214300C5E9C3 /* Patch.swift in Sources */ = {isa = PBXBuildFile; fileRef = D49FCBC51BBF214300C5E9C3 /* Patch.swift */; settings = {ASSET_TAGS = (); }; }; @@ -102,7 +101,6 @@ D4413FF01BB08FDC00E3C3C1 /* JSON.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSON.swift; sourceTree = ""; }; D45A36C81BBC667D00BE3DDE /* Category.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Category.swift; sourceTree = ""; }; D45A36CC1BBC75DF00BE3DDE /* Info.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Info.swift; sourceTree = ""; }; - D49FCBAC1BBD7A3100C5E9C3 /* AnyEquatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnyEquatable.swift; sourceTree = ""; }; D49FCBC11BBEF2C600C5E9C3 /* Fix.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Fix.swift; sourceTree = ""; }; D49FCBC31BBEF98E00C5E9C3 /* Free.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Free.swift; sourceTree = ""; }; D49FCBC51BBF214300C5E9C3 /* Patch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Patch.swift; sourceTree = ""; }; @@ -209,7 +207,6 @@ D4D7F3161BBB22E500AAB0C0 /* Hash.swift */, D45A36C81BBC667D00BE3DDE /* Category.swift */, D45A36CC1BBC75DF00BE3DDE /* Info.swift */, - D49FCBAC1BBD7A3100C5E9C3 /* AnyEquatable.swift */, D49FCBC11BBEF2C600C5E9C3 /* Fix.swift */, D49FCBC31BBEF98E00C5E9C3 /* Free.swift */, D49FCBC51BBF214300C5E9C3 /* Patch.swift */, @@ -403,7 +400,6 @@ D432D4731BA9C55300F3FABC /* Stream.swift in Sources */, D49FCBC61BBF214300C5E9C3 /* Patch.swift in Sources */, D4AAE5421B5AE2D0004E581F /* Doc.swift in Sources */, - D49FCBAD1BBD7A3100C5E9C3 /* AnyEquatable.swift in Sources */, D45A36CD1BBC75DF00BE3DDE /* Info.swift in Sources */, D4AAE5461B5AE2D0004E581F /* Parse.swift in Sources */, D49FCBC81BBF2C4300C5E9C3 /* Algorithm.swift in Sources */, diff --git a/prototype/Doubt/AnyEquatable.swift b/prototype/Doubt/AnyEquatable.swift deleted file mode 100644 index 6bd911a7b..000000000 --- a/prototype/Doubt/AnyEquatable.swift +++ /dev/null @@ -1,20 +0,0 @@ -/// An Equatable instance for any type for which you can provide an equality function. -/// -/// This can enable equating [T] where T does not conform to Equatable, by first mapping to [AnyEquatable] and then comparing with ==. -public enum AnyEquatable: Equatable { - case External(A, (A, A) -> Bool) - - public var value: A { - switch self { - case let .External(a, _): - return a - } - } -} - -public func == (left: AnyEquatable, right: AnyEquatable) -> Bool { - switch (left, right) { - case let (.External(a, eq), .External(b, _)): - return eq(a, b) - } -}