I have library method taking variable argument list and producing data
class Data
def process(elems: String*): Data = new Data
and I want my strings to be implicitly converted to Data
implicit def strToData(ts: String): Data = process(t)
so I can write something like
val data: Data = "one"
but I want tuples of strings to be implicitly converted too. I've added another implicit
implicit def strsToData(ts: String*): Data = process(ts: _*)
it compiles fine, but conversion fails
val data: Data = ("one", "two")
val dat3: Data = ("one", "two", "three")
val dat4: Data = ("one", "two", "three", "four")
with
found : Seq[java.lang.String]
required: this.Data
val data: Data = Seq("one", "two")
Is there any way to convert tuples implicitly, or a reason why it can be achieved?
Update: Tuples can be of any arity.