【发布时间】:2014-08-20 12:39:25
【问题描述】:
我有这些:
trait A[T]
class X
class Y
object B {
def method[H :< HList](h: H) = h.toList[A[_]]
}
method 的参数 h 将始终是 A[T] 的 HList,例如 new A[X] :: new A[Y] :: HNil。
我想将 HList 转换为 List[A[_]]。
由于 trait HList 没有 toList 方法(),我如何使用通用代码获得此功能?
【问题讨论】: