Reputation: 477
i have a sbt project that is configured with Dependencias.scala
, build.sbt
,plugins.sbt
, and i have this dependecy : https://christopherdavenport.github.io/cormorant/
lazy val `cormorant-core` = "io.chrisdavenport" %% "cormorant-core" % Version.cormorant
lazy val `cormorant-generic` = "io.chrisdavenport" %% "cormorant-generic" % Version.cormorant
lazy val `cormorant-parser` = "io.chrisdavenport" %% "cormorant-parser" % Version.cormorant
lazy val `cormorant-http4s` = "io.chrisdavenport" %% "cormorant-http4s" % Version.cormorant
lazy val `cormorant-refined` = "io.chrisdavenport" %% "cormorant-refined" % Version.cormorant
and when i compile it: sbt compile, it appears this error:
[error] /home/javier/IdeaProjects/ERPFetcherJavs/src/main/scala/com/arkondata/bipo/utils/CSVHandler.scala:11:53: could not find implicit value for parameter gen: shapeless.LabelledGeneric.Aux[A,H]
[error] private implicit val lr: LabelledRead[ItemData] = deriveLabelledRead
[error] ^
[error] /home/javier/IdeaProjects/ERPFetcherJavs/src/main/scala/com/arkondata/bipo/utils/CSVHandler.scala:13:54: could not find implicit value for parameter gen: shapeless.LabelledGeneric.Aux[A,H]
[error] private implicit val lw: LabelledWrite[ItemData] = deriveLabelledWrite
[error] ^
[error] two errors found
[error] (Compile / compileIncremental) Compilation failed
how can i fix it??
Upvotes: 0
Views: 409
Reputation: 8529
Let's assume ItemData
is a simple case class, for example:
case class ItemData(a: String)
Then, when running the code above, the error above reproduces. Why is that happening?
deriveLabelledRead
is a method at package io.chrisdavenport.cormorant.generic
, which takes 2 implicits:
def deriveLabelledRead[A, H <: HList](
implicit gen: LabelledGeneric.Aux[A, H],
hlw: Lazy[LabelledRead[H]])
After reading the docs, we need to do bunch of imports:
import io.chrisdavenport.cormorant._
import io.chrisdavenport.cormorant.generic.semiauto._
import io.chrisdavenport.cormorant.parser._
import io.chrisdavenport.cormorant.implicits._
import cats.implicits._
import java.util.UUID
import java.time.Instant
When importing those, deriveLabelledRead
has the implicits it needs to be created correctly.
Upvotes: 3