简体   繁体   English

选择无形HList而不是案例类

[英]choosing a shapeless HList instead of a case class

What are the advantages of using a shapeless HList over a case class in Scala? 在Scala中使用无形HList而不是案例类有什么好处? In what situations would you not want to use a HList? 在什么情况下,你会不会想使用HList?

You may want to read these questions first: 您可能希望首先阅读这些问题:

Essentially case classes are tuples underneath, which in turn map to a Java classes . 基本上case classes是下面的tuples ,它们又映射到Java classes However HList is a List like data structure. 然而, HListList like数据结构的List like So you may have to traverse the list to access a particular member HList . 因此,您可能必须遍历列表才能访问特定成员HList This is more costly than using a case class member or a tuple member. 这比使用案例类成员或元组成员更昂贵。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM