Scala 2.13.0 deprecates <%, but how do I get rid of this in a class definition

Something like
final class IndexMinPQ[K <% Ordered[K] : ClassTag](maxN: Int, nullKey: K = null) {...}
creates the new deprication warning
26: view bounds are deprecated; use an implicit parameter instead.
[warn] example: instead of def f[A <% Int](a: A) use def f[A](a: A)(implicit ev: A => Int)
[warn] final class IndexMinPQ[K <% Ordered[K] : ClassTag](maxN: Int,

I don’t mind that with methods, but I need it in a class definition.
What is the correct new syntax?

Thanks
Lothar

You can choose between

final class IndexMinPQ[K : ClassTag](maxN: Int, nullKey: K = null)(implicit ev: K => Ordered[K])

and

type IsOrdered[A] = A => Ordered[A]

final class IndexMinPQ[K : IsOrdered : ClassTag](maxN: Int, nullKey: K = null)

These two things and view bounds (<%) all desugar to the same thing.

1 Like

No difference between methods and classes – too easy. Thanks