Shapeless provides an implicit ToList, which, unsurprisingly, is used to convert HLists to lists.
To do this, it must first compute the LUB (smallest upper bound) types in the HList and that you can use:
import shapeless.ops.hlist.ToList
class Mappings[L <: HList, Lub](mappings:L)(implicit toList: ToList[L, Lub]) {
...
}
L , ( ) ToList, , L, Lub .
, Lub KeyMapping[String], , , String. , :
class Mappings[L <: HList, Lub, KeyType](mappings:L)(
implicit
val toList: ToList[L, Lub],
val kt: Lub <:< KeyMapping[KeyType]
) {
val k: KeyType = null.asInstanceOf[KeyType]
}
( val s, , , REPL)
, Lub KeyMapping[KeyType] (, ), KeyType . , , KeyType String.
, k, , ToList , mappings.toList