Skip to content

Instantly share code, notes, and snippets.

View retroryan's full-sized avatar

Ryan Knight retroryan

  • www.grandcloud.com
  • Park City, Utah
View GitHub Profile

Keybase proof

I hereby claim:

  • I am retroryan on github.
  • I am binaryknight (https://keybase.io/binaryknight) on keybase.
  • I have a public key whose fingerprint is E3F3 387C 700B 0653 3B79 0584 CFA0 3E0D EEDD D84C

To claim this, I am signing this object:

@retroryan
retroryan / gist:603d95313c3e5f2ec5c3
Created May 28, 2014 18:53
Play Json Reading a Recursive Class - Alternative Solution
trait Animal
case class Bird(name: String, wings: Boolean) extends Animal
case class Horse(name: String, height: Double) extends Animal
object Animal {
sealed abstract class QueryType[T] {
val data: T
}
case class IntQueryType(data: Int) extends QueryType[Int] with Ordered[IntQueryType] {
def compare(that: IntQueryType): Int = this.data - that.data
}
case class StringQueryType(data: String) extends QueryType[String] with Ordered[StringQueryType] {
def compare(that:StringQueryType):Int = this.data.compareTo(that.data)