Advertisement
Guest User

Untitled

a guest
Oct 24th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. import shapeless._
  2. import shapeless.ops.hlist._
  3. import shapeless.ops.record._
  4.  
  5. case class Foo(i: Int, b: String)
  6.  
  7. object Main {
  8.  
  9. def f[T, R <: HList, L <: HList]
  10. (g: LabelledGeneric.Aux[T, R])
  11. (implicit
  12. ks: Keys.Aux[R, L],
  13. tta: ToTraversable.Aux[L, Seq, Symbol],
  14. lub: LUBConstraint[L, Symbol]
  15. ) = {
  16. ks.apply.to[Seq].map(_.name)
  17. }
  18.  
  19. def main(args: Array[String]): Unit = {
  20. val g = LabelledGeneric[Foo]
  21. println(f(g))
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement