Last active
December 13, 2015 20:48
-
-
Save kareblak/4972197 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
trait JsonParser extends BodyParserModule { | |
def parse[String, O <: Parsable[O]](a: String): O = a match { | |
case O(o) => o | |
case _ => ??? | |
} | |
} | |
sealed trait Parsable[A] { | |
def parse(a: String): A | |
def unapply(a: String): A | |
} | |
case class AbvCalc(fg: Double, og: Double) extends Parsable[AbvCalc] { | |
def parse(a: String): AbvCalc = ??? | |
def unapply(a: String): Option[AbvCalc] = ??? | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment