-
-
Save hamnis/4976103 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 <: Parser[O]](a: String)(implicit Parser: O): O = a match { | |
case Parser(o) => o | |
case _ => ??? | |
} | |
} | |
sealed trait Parser[A] { | |
def parse(a: String): A | |
def unapply(a: String): A | |
} | |
object Parser { | |
implicit object AbvCalcParser extends Parser[AbvCalc] { | |
def parse(a: String): AbvCalc = ??? | |
def unapply(a: String): Option[AbvCalc] = ??? | |
} | |
} | |
case class AbvCalc(fg: Double, og: Double) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment