Last active
April 23, 2017 13:21
-
-
Save igstan/b786d870eb28d7e73dcf5223771db6c4 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
indirect enum Type: CustomStringConvertible { | |
case Int | |
case Fun(Type, Type) | |
var isFun: Bool { | |
switch self { | |
case .Fun: return true | |
case _: return false | |
} | |
} | |
var description: String { | |
switch self { | |
case .Int: return "int" | |
case .Fun(let p, let r) where p.isFun: return "(\(p)) -> \(r)" | |
case .Fun(let p, let r): return "(\(p) -> \(r))" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment