Implicits in Scala 2
You'll meet these in existing code and libraries:
Scala 3 still accepts most Scala 2 implicit syntax for migration, and can consume Scala 2.13 libraries (and vice versa via TASTy).
// Implicit parameters (≈ using)
def sorted[A](xs: List[A])(implicit ord: Ordering[A]): List[A] = xs.sorted(ord)
// Implicit values (≈ given)
implicit val defaultTimeout: Timeout = Timeout(5.seconds)
// Implicit classes (≈ extension methods)
implicit class RichInt(val n: Int) extends AnyVal { def squared: Int = n * n }
// Implicit conversions (≈ Conversion)
implicit def strToInt(s: String): Int = s.toInt
// Type class instances
implicit val showInt: Show[Int] = (a: Int) => a.toString
implicitly[Show[Int]]