I try this short snippet of code, where I try to constrain an Integer type using the Positive type from the refined library (https://github.com/fthomas/refined).
package xxx
import eu.timepit.refined._
import eu.timepit.refined.api.{Refined, Validate}
import eu.timepit.refined.auto._
import eu.timepit.refined.numeric._
import eu.timepit.refined.api.Refined
import eu.timepit.refined.numeric.Interval
object Lala {
type X = Integer Refined Positive
def lala(x: Int): Unit = {
val lala: X = refineV[X](x)
}
}
When compiling this snippet, I get this error message:
Error:(13, 29) could not find implicit value for parameter v: eu.timepit.refined.api.Validate[Int,xxx.Lala.X] val lala: X = refineVX
Error:(13, 29) not enough arguments for method apply: (implicit v: eu.timepit.refined.api.Validate[Int,xxx.Lala.X])Either[String,eu.timepit.refined.api.Refined[Int,xxx.Lala.X]] in class RefinePartiallyApplied. Unspecified value parameter v. val lala: X = refineVX
From which it seems that a Validate implementation for the Positive type is missing. I was wondering whether someone could help me find an instance of the Validate trait for the Positive type? Or should I provide such an instance myself?