You can build such a reshaper with almost no change in your code or custom classes. We simply precede the argument lists, and then align the result of LabelledGeneric[MyClass]#Repr :
import shapeless._ import syntax.singleton._ import ops.hlist._ class PartialConstructor[C, Default <: HList, Repr <: HList] (default: Default) (implicit lgen: LabelledGeneric.Aux[C, Repr]) { def apply[Args <: HList, Full <: HList] (args: Args) (implicit prepend: Prepend.Aux[Default, Args, Full], align: Align[Full, Repr]): C = lgen.from(align(default ++ args)) } class Reshaper[C]() { def apply[Default <: HList, Repr <: HList] (default: Default) (implicit lgen: LabelledGeneric.Aux[C, Repr]) = new PartialConstructor[C, Default, Repr](default) } def reshape[C] = new Reshaper[C]
source share