Skip to content

Instantly share code, notes, and snippets.

@aktau
Created September 13, 2012 08:21
Show Gist options
  • Save aktau/3712840 to your computer and use it in GitHub Desktop.
Save aktau/3712840 to your computer and use it in GitHub Desktop.
scala combinedtablemetadata
// doesn't work
class CombinedTableMetadata[A](op: (List[A], List[A]) => List[A]) {
val listInts1 : List[Int]
val listInts2 : List[Int]
val listStrings1: List[String]
val listStrings2: List[String]
def doThis : List[Int] = op(listInts1, listInts2)
def doThat : List[String] = op(listStrings1, listStrings2)
}
// works
class CombinedTableMetadata2 {
def op[A](left: List[A], right: List[A]) : List[A]
val listInts1 : List[Int]
val listInts2 : List[Int]
val listStrings1: List[String]
val listStrings2: List[String]
def doThis : List[Int] = op(listInts1, listInts2)
def doThat : List[String] = op(listStrings1, listStrings2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment