Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save qingwei91/aaccec14d07b88bf59a67789d6d4ddca to your computer and use it in GitHub Desktop.
implicit val queryHFunctor: HFunctor[QueryF] = new HFunctor[QueryF] {
def hmap[I[_], J[_]](nt: I ~> J): QueryF[I, ?] ~> QueryF[J, ?] = {
new (QueryF[I, ?] ~> QueryF[J, ?]) {
def apply[A](a: QueryF[I, A]): QueryF[J, A] = {
a match {
case QueryStringF => QueryStringF
case QueryBoolF => QueryBoolF
case query: QueryPathF[I, A] => QueryPathF(query.path, nt(query.next))
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment