Generic Implicit Conversion in Scala 3

Scala 3 has implicit conversions, for example:

given Conversion[String, Token] with
  def apply(str: String): Token = new KeyWord(str)

Can an implicit conversion be defined between generic types (e.g. between lists and vectors)? If, so, how would it look?

given listVectorConversion[T]: Conversion[List[T], Vector[T]] with
  def apply(x: List[T]): Vector[T] = x.toVector

(Personally, Iā€™d strive to keep implicit conversions to a minimum in general, and specifically for collections - collection polymorphism already comes with enough pitfalls as is.)

2 Likes

Thank you!

(I just used lists and vectors as a simple example.)