In Scala2, I sometimes write implicit conversions with implicit parameters like this:
implicit def convert(i: Int)(implicit ev: Runnable[Int]): Unit =
ev.r(i) // method r is a method inside ev
However, I don’t know how to write this in Scala3 with given conversion
. The Conversion
needs to take exactly 2 type parameters but I need more:
given Conversion[???, Unit] with
def apply(i: Int)(using ev: Runnable[Int]): Unit =
i.r() // method r is an extension method inside ev
What should I code inside Conversion[???, Unit]
?