Why doesn\'t the following implicit conversion work even though explicitly calling the function works?
scala> implicit def view[A, C](xs: C)(implicit ev:
Simply put, as the error message suggests, it cannot infer A
. There's no information the compiler can use to infer what A
must be, so it must assume it can be anything.
You might retort that it can infer A
from C <:< Iterable[A]
, but that would turn the problem on its head: instead of using <:<
to check constraints, it would use the constraints to infer the type of A
! That logic is not sound.