title: Workaround for Scala RDD not being covariant
body: <p>I'm trying to write a function to operate on RDD[Seq[String]] objects, e.g.:</p>
  
  <pre><code>def foo(rdd: RDD[Seq[String]]) = { println("hi") }
  </code></pre>
  
  <p>This function cannot be called on objects of type RDD[Array[String]]:</p>
  
  <pre><code>val testRdd : RDD[Array[String]] = sc.textFile("somefile").map(_.split("\\|", -1))
  foo(testRdd)
  
  -&gt;
  error: type mismatch;
  found   : org.apache.spark.rdd.RDD[Array[String]]
  required: org.apache.spark.rdd.RDD[Seq[String]]
  </code></pre>
  
  <p>I guess that's because RDD isn't covariant.</p>
  
  <p>I've tried a bunch of definitions of foo to get around this. Only one of them has compiled:</p>
  
  <pre><code>def foo2[T[String] &lt;: Seq[String]](rdd: RDD[T[String]]) = { println("hi") }
  </code></pre>
  
  <p>But it's still broken:</p>
  
  <pre><code>foo2(testRdd)
  
  
  -&gt;
  &lt;console&gt;:101: error: inferred type arguments [Array] do not conform to method foo2's type
  parameter bounds [T[String] &lt;: Seq[String]]
            foo2(testRdd)
            ^
  &lt;console&gt;:101: error: type mismatch;
  found   : org.apache.spark.rdd.RDD[Array[String]]
  required: org.apache.spark.rdd.RDD[T[String]]
  </code></pre>
  
  <p>Any idea how I can work around this? This is all taking place in the Spark shell.</p>