Tuple to HList using productElements

不想你离开。 提交于 2019-12-07 14:49:53

问题


I am using Shapeless 2.2.5. I try to convert a tuple to HList using the code below.

 import shapeless._
import syntax.std.product._

(23, "foo", 2.0, true).productElements

But I get a compilation error.

[error] /scala/testScala/src/test/scala/lombok/shapeless/TestTuple2HList.scala:12: could not find implicit value for parameter gen: shapeless.Generic[(Int, String, Double, Boolean)]
[error]      (23, "foo", 2.0, true).productElements

The test conversions.scala in https://github.com/milessabin/shapeless/blob/master/core/src/test/scala/shapeless/conversions.scala

did not provide an implicit value for Generic[(Int,String,Double,Boolean)].

Have I missed some imports ?

Thanks in advance for any assistance !

Shing


回答1:


It should be import syntax.std.tuple._ rather than import syntax.std.product._.



来源:https://stackoverflow.com/questions/35258391/tuple-to-hlist-using-productelements

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!