Skip to content

Instantly share code, notes, and snippets.

@emres
Created January 4, 2014 19:03
Show Gist options
  • Save emres/8259258 to your computer and use it in GitHub Desktop.
Save emres/8259258 to your computer and use it in GitHub Desktop.
object LivesIn {
def unapply(p: Person): Option[Seq[String]] =
Some(
for(r <- p.residence)
yield r.city
)
}
class StringSeqContains(value: String) {
def unapply(in: Seq[String]): Boolean =
in contains value
}
val Istanbul = new StringSeqContains("Istanbul")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment