Created
June 22, 2015 00:44
-
-
Save superlopuh/9d2a346c2f6bb02583a5 to your computer and use it in GitHub Desktop.
Written as an attempted solution to Brent Simmons's blog post.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Written by Alexandre Lopoukhine | |
protocol Value: Equatable {} | |
protocol Smashable { | |
typealias SmashValue | |
func valueBySmashingOtherValue<T: Value>(value: T) -> SmashValue | |
} | |
struct Bar: Value { | |
} | |
func ==(lhs: Bar, rhs: Bar) -> Bool { | |
return true | |
} | |
struct Foo { | |
typealias SmashValue = Bar | |
func valueBySmashingOtherValue<T: Value>(value: T) -> Bar { | |
return Bar() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment