title: What is the idiomatic way to pattern match sequence comprehensions?
body: <pre><code>val x = for(i &lt;- 1 to 3) yield i
  x match {
      case 1 :: rest =&gt; ... // compile error
  }
  </code></pre>
  
  <blockquote>
    <p>constructor cannot be instantiated to expected type; found :
    collection.immutable.::[B] required:
    scala.collection.immutable.IndexedSeq[Int]</p>
  </blockquote>
  
  <p>This is the same problem as <a href="https://stackoverflow.com/questions/10199171/matcherror-when-match-receives-an-indexedseq-but-not-a-linearseq">MatchError when match receives an IndexedSeq but not a LinearSeq</a>.</p>
  
  <p>The question is, how to do it right? Adding <code>.toList</code> everywhere doesn't seem right. And creating an own extractor which handles every <code>Seq</code> (as described in the answer of the other question) would lead to a mess if everybody would do it...</p>
  
  <p>I guess the question is, why can't I influence what the return type of sequence comprehensions is, or: why isn't such a generalized <code>Seq</code> extractor part of the standard library?</p>