1
1
mirror of https://github.com/github/semantic.git synced 2024-11-29 21:52:59 +03:00

AnyEquatable.

This commit is contained in:
Rob Rix 2015-10-01 10:28:14 -04:00
parent 279aab6530
commit 079b3a479e
2 changed files with 14 additions and 0 deletions

View File

@ -22,6 +22,7 @@
D45A36C91BBC667D00BE3DDE /* Category.swift in Sources */ = {isa = PBXBuildFile; fileRef = D45A36C81BBC667D00BE3DDE /* Category.swift */; settings = {ASSET_TAGS = (); }; }; 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 = (); }; }; D45A36CD1BBC75DF00BE3DDE /* Info.swift in Sources */ = {isa = PBXBuildFile; fileRef = D45A36CC1BBC75DF00BE3DDE /* Info.swift */; settings = {ASSET_TAGS = (); }; };
D49C2CA41BBD72E300949127 /* AnyHashable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D49C2CA31BBD72E300949127 /* AnyHashable.swift */; settings = {ASSET_TAGS = (); }; }; D49C2CA41BBD72E300949127 /* AnyHashable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D49C2CA31BBD72E300949127 /* AnyHashable.swift */; settings = {ASSET_TAGS = (); }; };
D49FCBAD1BBD7A3100C5E9C3 /* AnyEquatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D49FCBAC1BBD7A3100C5E9C3 /* AnyEquatable.swift */; settings = {ASSET_TAGS = (); }; };
D4A71DC51BB45B850051416D /* Vertex.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4A71DC41BB45B850051416D /* Vertex.swift */; settings = {ASSET_TAGS = (); }; }; D4A71DC51BB45B850051416D /* Vertex.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4A71DC41BB45B850051416D /* Vertex.swift */; settings = {ASSET_TAGS = (); }; };
D4A71DC71BB4AC9E0051416D /* VertexTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4A71DC61BB4AC9E0051416D /* VertexTests.swift */; settings = {ASSET_TAGS = (); }; }; D4A71DC71BB4AC9E0051416D /* VertexTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4A71DC61BB4AC9E0051416D /* VertexTests.swift */; settings = {ASSET_TAGS = (); }; };
D4AAE50E1B5AE22E004E581F /* Doubt.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D4AAE4FD1B5AE22E004E581F /* Doubt.framework */; }; D4AAE50E1B5AE22E004E581F /* Doubt.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D4AAE4FD1B5AE22E004E581F /* Doubt.framework */; };
@ -100,6 +101,7 @@
D45A36C81BBC667D00BE3DDE /* Category.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Category.swift; sourceTree = "<group>"; }; D45A36C81BBC667D00BE3DDE /* Category.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Category.swift; sourceTree = "<group>"; };
D45A36CC1BBC75DF00BE3DDE /* Info.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Info.swift; sourceTree = "<group>"; }; D45A36CC1BBC75DF00BE3DDE /* Info.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Info.swift; sourceTree = "<group>"; };
D49C2CA31BBD72E300949127 /* AnyHashable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnyHashable.swift; sourceTree = "<group>"; }; D49C2CA31BBD72E300949127 /* AnyHashable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnyHashable.swift; sourceTree = "<group>"; };
D49FCBAC1BBD7A3100C5E9C3 /* AnyEquatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnyEquatable.swift; sourceTree = "<group>"; };
D4A71DC41BB45B850051416D /* Vertex.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Vertex.swift; sourceTree = "<group>"; }; D4A71DC41BB45B850051416D /* Vertex.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Vertex.swift; sourceTree = "<group>"; };
D4A71DC61BB4AC9E0051416D /* VertexTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VertexTests.swift; sourceTree = "<group>"; }; D4A71DC61BB4AC9E0051416D /* VertexTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VertexTests.swift; sourceTree = "<group>"; };
D4AAE4FD1B5AE22E004E581F /* Doubt.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Doubt.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D4AAE4FD1B5AE22E004E581F /* Doubt.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Doubt.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@ -208,6 +210,7 @@
D45A36C81BBC667D00BE3DDE /* Category.swift */, D45A36C81BBC667D00BE3DDE /* Category.swift */,
D45A36CC1BBC75DF00BE3DDE /* Info.swift */, D45A36CC1BBC75DF00BE3DDE /* Info.swift */,
D49C2CA31BBD72E300949127 /* AnyHashable.swift */, D49C2CA31BBD72E300949127 /* AnyHashable.swift */,
D49FCBAC1BBD7A3100C5E9C3 /* AnyEquatable.swift */,
D4AAE5001B5AE22E004E581F /* Supporting Files */, D4AAE5001B5AE22E004E581F /* Supporting Files */,
); );
path = Doubt; path = Doubt;
@ -396,6 +399,7 @@
D432D4731BA9C55300F3FABC /* Stream.swift in Sources */, D432D4731BA9C55300F3FABC /* Stream.swift in Sources */,
D4AAE5421B5AE2D0004E581F /* Doc.swift in Sources */, D4AAE5421B5AE2D0004E581F /* Doc.swift in Sources */,
D49C2CA41BBD72E300949127 /* AnyHashable.swift in Sources */, D49C2CA41BBD72E300949127 /* AnyHashable.swift in Sources */,
D49FCBAD1BBD7A3100C5E9C3 /* AnyEquatable.swift in Sources */,
D432D4771BA9FE6A00F3FABC /* Comparable.swift in Sources */, D432D4771BA9FE6A00F3FABC /* Comparable.swift in Sources */,
D45A36CD1BBC75DF00BE3DDE /* Info.swift in Sources */, D45A36CD1BBC75DF00BE3DDE /* Info.swift in Sources */,
D4AAE5461B5AE2D0004E581F /* Parse.swift in Sources */, D4AAE5461B5AE2D0004E581F /* Parse.swift in Sources */,

View File

@ -0,0 +1,10 @@
public enum AnyEquatable<A>: Equatable {
case External(A, (A, A) -> Bool)
}
public func == <A> (left: AnyEquatable<A>, right: AnyEquatable<A>) -> Bool {
switch (left, right) {
case let (.External(a, eq), .External(b, _)):
return eq(left, right)
}
}