title: Scala for-comprehension type inference
body: <p>The next code </p>
  
  <pre><code>  def f(chars: List[Char]): List[List[Char]] = chars match {
      case Nil =&gt; List(Nil)
      case x :: xs =&gt; for {
        v &lt;- f(xs)
      } yield List(x) :: v
    }
  </code></pre>
  
  <p>gives the error message </p>
  
  <pre><code>- type mismatch;  found   : List[List[Any]]  required: List[List[Char]]
  </code></pre>
  
  <p>Please help me understand why 'for' chooses the most general Any instead of Char here? What topic in language spec should I read? Thanks. </p>