In the following code, the last line doesn't work:
case class B(v:String)
case class C(s:B,r:B)
object TestImplicits {
implicit def str2b(s:String) : B = B(s)
implicit def in2b(i:(B,B)) :C = C(i._1,i._2)
val t : B = "hello"
val tb : (B,B) = ("hello","there")
val c : C = tb
val cb : C = (B("hello"),B("there"))
val n : C = ("hello","there")
}
I don't understand why not - it knows how to convert (B,B)->C, and String->B, it can turn (String,String) -> (B,B). All the pieces are there, but it doesn't work without an explicit (String,String)->C method.
Is there any workaround?