Skip to content

Instantly share code, notes, and snippets.

@dragos
Created November 16, 2015 11:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dragos/7873a12a99a0f0ab1160 to your computer and use it in GitHub Desktop.
Save dragos/7873a12a99a0f0ab1160 to your computer and use it in GitHub Desktop.
Overloading Dataset.map
trait Encoder[T]
trait JFunction[T, U]
trait Dataset[T] {
def map[U](f: T => U)(implicit encoder: Encoder[U])
def map[U](f: JFunction[T, U], encoder: Encoder[U])
}
trait Testing {
implicit val e: Encoder[Int] = ???
val f: Dataset[String] = ???
f.map(x => x.length())
f.map(null, e)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment