doobie
doobie copied to clipboard
New type derivation not working on list types
Read not derived, next code results in such error
Cannot find or construct a Read instance for type: com.test.Main.DataWrapper2
But derivation works with simple Read[NewTypeWrapper]
package com.test
import doobie._
import doobie.postgres.implicits._
import io.estatico.newtype.macros.newtype
object Main extends App {
@newtype case class NewTypeWrapper(value: Int)
object NewTypeWrapper {
implicit val read: Read[NewTypeWrapper] = Read[Int].map(NewTypeWrapper(_))
}
case class DataWrapper(one: NewTypeWrapper)
case class DataWrapper1(list: List[Int])
case class DataWrapper2(list: List[NewTypeWrapper])
val t = NewTypeWrapper(1)
println(Read[NewTypeWrapper])
println(Read[DataWrapper])
println(Read[DataWrapper1])
println(Read[DataWrapper2])
}
May be solution described here https://github.com/tpolecat/doobie/issues/691