Skip to content

Instantly share code, notes, and snippets.

@kevinmeredith
Created October 27, 2016 15:20
Show Gist options
  • Select an option

  • Save kevinmeredith/ca04a862c778fa8e9fc60a1257179533 to your computer and use it in GitHub Desktop.

Select an option

Save kevinmeredith/ca04a862c778fa8e9fc60a1257179533 to your computer and use it in GitHub Desktop.
Type-class within case class
trait Reads[A]
case class Service(a: String) {
implicit val xReads = X.reads(this)
}
case class X(y: Int)
object X {
def reads(s: Service): Reads[X] = new Reads[X] {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment