Scala 如何在zipWithIndex之后映射不成形的HList?

Scala 如何在zipWithIndex之后映射不成形的HList?,scala,shapeless,Scala,Shapeless,我想将一些case类转换为HList,然后使用索引压缩返回的HList,然后使用索引映射它: class B[A]() { def foo[H <: HList](tuple: A)(implicit gen: Generic.Aux[A, H], zip: ZipWithIndex[H],

我想将一些case类转换为HList,然后使用索引压缩返回的HList,然后使用索引映射它:

class B[A]() {    
  def foo[H <: HList](tuple: A)(implicit gen: Generic.Aux[A, H],
                                               zip: ZipWithIndex[H],
                                               mapper: Mapper[UpdateOps.type, ZipWithIndex[H]#Out]) = {
    gen.to(tuple).zipWithIndex.map(UpdateOps)
  }
}
问题是我遇到了一个编译错误:

错误:(24,35)找不到参数映射器的隐式值: shapeless.ops.hlist.Mapper[UpdateOps.type,zip.Out] gen.to(tuple).zipWithIndex.map(UpdateOps)错误:(24,35)方法映射的参数不足:(隐式映射器: shapeless.ops.hlist.Mapper[UpdateOps.type,zip.Out])Mapper.Out。 未指定值参数映射器。 gen.to(tuple.zipWithIndex.map(UpdateOps)

若我只是映射HList,那个么就并没有错误,但我需要保存索引。
有可能实现吗?

您可以使用
Aux
模式将隐式解析类型的输出类型用作下一个类型的输入类型:

B类[A](){
德福[
H
 object UpdateOps extends Poly1 {
    ??? // not implemented yet
  }