The following code is a typical demo of one of shapeless' use case:
def getHList[P <: Product, F, L <: HList](p: P)(implicit gen: Generic.Aux[P, L]): L = {
gen.to(p)
}
val v = getHList(1, 2, 3, 4, 5, 6, 7, 8, 9)
This gives the proper result, unfortunately, it relies on scala's tuple syntactic suger, and doesn't work when the number of argument > 22:
val v = getHList(1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0)
(this generates an error that looks this the follow)
[Error] /xxx/HListSuite.scala:41: 29 more arguments than can be applied to method getHList: (p: P)(implicit gen: shapeless.Generic.Aux[P,L])L
one error found
FAILURE: Build failed with an exception.
I wonder if there is a macro or another scala feature I can use to break this limitation, any advice?
I'm using scala 2.12.8 but can upgrade to 2.13 at any time.