I'm trying to use Shapeless Poly in another method like this:
object poly extends Poly1 {
implicit val caseInt = at[Int](_.toString)
implicit val caseString = at[String](_.toString)
}
def f[A, P <: Poly](a: A, p: P) = println(p(a))
this gives
could not find implicit value for parameter cse: shapeless.poly.Case[p.type,shapeless.::[A,shapeless.HNil]]
Any suggestion on how to make this works?
Poly.applyrequires an implicit evidence of theCaseimplicit, which is what you provide it via theat[A]helper method.We need to add that same implicit requirement to
f: