title: matching types in scala
body: <p>Is it possible to match types in Scala? Something like this:</p>
  
  <pre><code>  def apply[T] = T match {
      case String =&gt; "you gave me a String",
      case Array  =&gt; "you gave me an Array"
      case _ =&gt; "I don't know what type that is!"
    }
  </code></pre>
  
  <p>(But that compiles, obviously :))</p>
  
  <p>Or perhaps the right approach is type overloading…is that possible?</p>
  
  <p>I cannot pass it an instance of an object and pattern match on that, unfortunately.</p>