Skip to content

Instantly share code, notes, and snippets.

@tstone
Created November 11, 2013 22:11
Show Gist options
  • Save tstone/7421402 to your computer and use it in GitHub Desktop.
Save tstone/7421402 to your computer and use it in GitHub Desktop.
implicit class Unlessable[A](a: => A) {
def unless(p: => Boolean) = if (!p) Some(a) else None
}
implicit class Iffable[A](a: => A) {
def iff(p: => Boolean) = if (p) Some(a) else None
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment