Skip to content

Instantly share code, notes, and snippets.

@MasseGuillaume
Created August 1, 2014 14:15
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 MasseGuillaume/9c0c79a2468af211724b to your computer and use it in GitHub Desktop.
Save MasseGuillaume/9c0c79a2468af211724b to your computer and use it in GitHub Desktop.
Serialize type class
object TC {
trait Ser[In, Out] {
def ser(in: In): Out
}
implicit object StringString extends Ser[String, String] {
def ser(a: String) = a
}
}
object A extends App{
import TC._
def doSer[In, Out](a: In)(implicit ev: Ser[In, Out]): Out = ev.ser(a)
doSer("test")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment