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
import play.api.libs.json._ | |
import play.api.libs.functional.syntax._ | |
sealed trait Shape | |
case class Circle(c: (Float, Float), r: Float) extends Shape | |
object Circle { | |
// reader is covariant and can be implicit in inheriting caseclasses | |
implicit val reader = Json.reads[Circle] | |
// writer is contravariant and can't be implicit in inheriting caseclasses |
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
package controllers; | |
import play.*; | |
import play.mvc.*; | |
import views.html.*; | |
public class Application extends Controller { | |
public static Result index(String name) { |