Skip to content

Instantly share code, notes, and snippets.

@maleficarum
Created January 10, 2012 22:47
Show Gist options
  • Save maleficarum/1591685 to your computer and use it in GitHub Desktop.
Save maleficarum/1591685 to your computer and use it in GitHub Desktop.
Ternary operator implementation for scala
case class Bool(b: Boolean) {
def ?[X](t: => X) = new {
def |(f: => X) = if(b) t else f
}
}
object Bool {
implicit def BooleanBool(b: Boolean) = Bool(b)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment