Shapeless mapping and subtype polymorphism with custom type bound
问题 Trying to map an HList of a custom polymorphic class I'm getting the dreaded "could not find implicit value for parameter mapper" error. A code sample: import shapeless._ trait SubTrait case class A() extends SubTrait case class B() extends SubTrait case class C[T <: SubTrait](x: T) object TheMapper extends Poly1 { implicit def default[T <: SubTrait, L[T] <: C[T]] = at[L[T]](_.x) } val ab = C(A()) :: C(B()) :: HNil println(ab.map(TheMapper)) This works fine if the bound for L[T] is e.g.