I have an abstract class with a method that receives an HList's as parameter (A). However in the subclasses I'd like to restrict the exact types of this HList (B)
The code below doesn't work (it doesn't see (Int :: String :: HNil)
as subclass of HList
. But how can achieve a similar effect?
import shapeless.{::, HList, HNil}
import shapeless.syntax.std.tuple._
abstract class A{
def test[H <: HList](h: H): String
}
class B extends A {
override def test(h: (Int :: String :: HNil)): String = {
val a = h(0)
val b = h(1)
s"$a -- $b"
}
}
new B().test(25 :: "testje" :: HNil)