Created
January 31, 2017 19:30
-
-
Save cakper/37675c917c9f034096ba3af9347cf320 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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