An implicit conversion from type S to type T is defined by an implicit value which has function type S => T, or by an implicit method convertible to a value of that type.
Implicit conversions are applied in two situations:
- If an expression e is of type S, and S does not conform to the expression’s expected type T.
- In a selection e.m with e of type S, if the selector m does not denote a member of S.
In the first case, a conversion c is searched for which is applicable to e and whose result type conforms to T. In the second case, a conversion c is searched for which is applicable to e and whose result contains a member named m.
If an implicit method List[A] => Ordered[List[A] ] is in scope, as well as an implicit method Int => Ordered[Int], the following operation on the two lists of type List[Int] is legal:
List(1, 2, 3) <= List(4, 5)
An implicit method Int => Ordered[Int] is provided automatically through scala.Predef.intWrapper. An example of an implicit method List[A] => Ordered[List[A = new Ordered[List[A