Skip to content

Instantly share code, notes, and snippets.

@dwins
Created January 11, 2011 20:14
Show Gist options
  • Save dwins/775038 to your computer and use it in GitHub Desktop.
Save dwins/775038 to your computer and use it in GitHub Desktop.
trait MyString {
def theString: String
}
case class AString(theString: String) extends MyString
case class IntAsString(theInt: Int) extends MyString {
def theString = theInt.toString
}
object MyString {
def unapply(ms: MyString) = Some(ms.theString)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment