Created
December 23, 2016 22:46
-
-
Save kindlychung/abbc96e9d4d3df05dc78b3d9ab12d060 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
case class User(name: String, age: Int) | |
object User { | |
implicit val userPrinter: InfoPrinter[User] = new InfoPrinter[User] { | |
override def toInfo(value: User) = s"[User] name: ${value.name}, age: ${value.age}" | |
} | |
} | |
val userInfo = implicitly[InfoPrinter[User]].toInfo(User("Xiaohong", 24)) | |
println(userInfo) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment