How to implicitly figure out the type at the head of a shapeless HList
问题 Lets say I have the following: case class TestField(value: String) case class TestField2(value: String) implicit class ProductExtensions[T <: Product](val value T) extends AnyVal { def mapTo[R <: Product](implicit tGen: Generic.Aux[T, String :: HNil], rGen: Generic.Aux[R, String :: HNil]: R = ??? } val testField2 = TestField("my value").mapTo[TestField2] // TestField2("my value") Can I "genersize" the mapTo function to work for types other than String without having to specify the type? Note