Skip to content

Instantly share code, notes, and snippets.

@hartbit
Created June 21, 2015 19:06
Show Gist options
  • Save hartbit/45176895342030553cfc to your computer and use it in GitHub Desktop.
Save hartbit/45176895342030553cfc to your computer and use it in GitHub Desktop.
protocol Value: Equatable {
}
protocol Smashable {
typealias T: Value
func valueBySmashing​OtherValue​(value: T) -> T
}
struct Foo : Value, Smashable {
typealias T = Bar
func valueBySmashing​OtherValue​(value: Bar) -> Bar {
return Bar()
}
}
func == (lhs: Foo, rhs: Foo) -> Bool {
return true
}
struct Bar: Value {
}
func == (lhs: Bar, rhs: Bar) -> Bool {
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment