I want to convert some case class into HList, then zip with index the returned HList and then map it with indexes:
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)
}
}
Where UpdateOps
is a package object:
object UpdateOps extends Poly1 {
??? // not implemented yet
}
The problem is that i got a compile error:
Error:(24, 35) could not find implicit value for parameter mapper: shapeless.ops.hlist.Mapper[UpdateOps.type,zip.Out] gen.to(tuple).zipWithIndex.map(UpdateOps) Error:(24, 35) not enough arguments for method map: (implicit mapper: shapeless.ops.hlist.Mapper[UpdateOps.type,zip.Out])mapper.Out. Unspecified value parameter mapper. gen.to(tuple).zipWithIndex.map(UpdateOps)
If i just map HList then there is no errors, but i need to save indexes. Is it possible to achieve it?