abstract class Test[T] {
type Value
}
// This is wrong with respect to Scala syntax.
def fun(tests: Test[_]*): Tuple(tests(0)#Value, tests(1)#Value) = {
}
我想要的是对任意数量的var args的arity抽象,其中类型由抽象类型成员Value
持有,如上所示。例如,从任何arity转到Product,从Product转到HList或其他任何东西,然后从那个转到元组。
def test[F, A, L, S, Rc <: Test[_]](f: F)(implicit ftp: FnToProduct.Aux[F, L => S],
ev: S <:< Seq[Rc#Value]) {
val sq = ev(ftp(f))
// now I'd like to build a type to reference the return sequence in a tuple
// What is the real way to do the below?
type ReturnTpe = sq.foldLeft(HNil)((l, col) => col#Value :: l).tupled
}