title: Pattern Matching/Checking Arity of Function1
body: <p>Given the following method:</p>
  
  <pre><code>scala&gt; def f: List[Any] =&gt; Any = xs =&gt; 1234 // this output does not matter
  f: List[Any] =&gt; Any
  </code></pre>
  
  <p>Is it possible to pattern match on <code>List[Any] =&gt; Any</code>? I don't see an <code>unapply</code> method on <a href="http://www.scala-lang.org/api/current/index.html#scala.Function1" rel="nofollow">Function1</a>, so I believe the answer is no.</p>
  
  <p>Here's what I'm trying to do:</p>
  
  <p>Example:</p>
  
  <pre><code>def foo(x: Any) = x match { 
     case ... // to handle the case of List[Any] =&gt; Any]?
     case ...
  }
  </code></pre>
  
  <p>Perhaps I can figure out the <code>arity</code> of <code>x: Any</code> to differentiate between <code>List[Any] =&gt; Any</code> versus everything else (<code>_</code>)?</p>
  
  <p><strong>EDIT</strong>: </p>
  
  <p>I hope that I do not have to rely on <code>f.toString</code> == <code>&lt;function1&gt;</code>.</p>