title: Scala Pattern Matching with Sets
body: <p>The following doesn't work.</p>
  
  <pre><code>object Foo {
      def union(s: Set[Int], t: Set[Int]): Set[Int] = t match {
          case isEmpty =&gt; s
          case (x:xs)  =&gt; union(s + x, xs)
          case _       =&gt; throw new Error("bad input")
      }
  }
  </code></pre>
  
  <blockquote>
    <p>error: not found: type xs</p>
  </blockquote>
  
  <p>How can I pattern match over a set?</p>