Skip to content

Instantly share code, notes, and snippets.

@cakper
Created January 31, 2017 19:30
Show Gist options
  • Save cakper/37675c917c9f034096ba3af9347cf320 to your computer and use it in GitHub Desktop.
Save cakper/37675c917c9f034096ba3af9347cf320 to your computer and use it in GitHub Desktop.
trait CsvEncoder[A] {
def encode(value: A): List[String]
}
def createEncoder[A](func: A => List[String]): CsvEncoder[A] = {
new CsvEncoder[A] {
override def encode(value: A) = func(value)
}
}
def createEncoderSam[A](func: A => List[String]): CsvEncoder[A] = func(_: A)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment