Skip to content

Instantly share code, notes, and snippets.

@rayfix
Last active Aug 29, 2015
Embed
What would you like to do?
struct TaggedThing<Tag, Thing> {
var value: Thing
}
protocol A {} // Phantom Type
protocol B {} // Phantom Type
var a = TaggedThing<A, Int>(value: 1)
var b = TaggedThing<B, Int>(value: 2)
a.value // 1
b.value // 2
// a = b compilation error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment