Skip to content

Instantly share code, notes, and snippets.

@qingwei91
Created March 14, 2019 20:33
Show Gist options
  • Select an option

  • Save qingwei91/98197573d7e24c37bead324b5405fcdb to your computer and use it in GitHub Desktop.

Select an option

Save qingwei91/98197573d7e24c37bead324b5405fcdb to your computer and use it in GitHub Desktop.
// simplified
sealed trait Query[A]
case object QueryString extends Query[String]
case object QueryBool extends Query[Boolean]
case class QueryPath[A](path: String, next: Query[A]) extends Query[A]
// sample data
// {
// "oh": {
// "my": "zsh"
// }
// }
// expression to query _.oh.my from JSON above
val expression = QueryPath("oh", QueryPath("my", QueryString))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment