我有以下案例类:
case class QueryResult[T: Decoder](data: T)
它适用于自动推导。
但我无法解决它进行半自动推导。
这是我的测试用例:
//import io.circe.generic.auto._ // with this it works
import io.circe.derivation._
case class Name(name: String)
case class QueryResult[T: Decoder](data: T)
implicit val nameDer = deriveDecoder[Name]
implicit def result[T: Decoder] = deriveDecoder[QueryResult[T]] // this does not work
这给了我:
Error:(16, 50) No method evidence$1 in pme123.graphql.client.QueryResult[T] (this is probably because a constructor parameter isn't a val)
implicit def result[T: Decoder] = deriveDecoder[QueryResult[T]]