Created
September 28, 2015 11:40
-
-
Save oisdk/53d5ed908a5f3edd3668 to your computer and use it in GitHub Desktop.
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
protocol Bit {} | |
protocol IsSet {} | |
protocol IsClr {} | |
struct Set : Bit, IsSet {} | |
struct Clr : Bit, IsClr {} | |
protocol Op { typealias Result } | |
extension Op { typealias Result = Set } | |
struct Nand<B0: Bit, B1: Bit> : Op {} | |
extension Nand where B0: IsSet, B1: IsSet { | |
typealias Result = Clr | |
} | |
struct Not<B: Bit> {} | |
extension Not where B: IsSet { | |
typealias Result = Clr | |
} | |
struct And<B0: Bit, B1: Bit> { | |
typealias Result = Not<Nand<B0, B1>.Result>.Result | |
} | |
// ambiguous type name 'Result' in 'Nand<B0, B1>' | |
Nand<Clr, Clr>.Result.self | |
Nand<Clr, Set>.Result.self | |
Nand<Set, Clr>.Result.self | |
Nand<Set, Set>.Result.self |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment