title: How to test that an object is not a function in scala
body: <p>My problem is quite simple : I want to have an implicit conversion of value to function <em>if they are not already function</em>. I plan to use a type safe pattern by requesting the instantiation of an implicit parameter (if the valueis a function the implicit creation fails). 
  However I do not see how to test that a value is not a function</p>
  
  <p>I learned type safe pattern from user Beryllium in one of my previous question. See :
  <a href="https://stackoverflow.com/questions/17882998/type-safe-method-chaining-that-doesnt-allow-repeats-of-operations">Type safe method chaining that doesn&#39;t allow repeats of operations</a></p>
  
  <p>The implicit I've implemented is working, but too well. I want to transform not function expression to specific-application-default function automatically</p>
  
  <pre><code> implicit def defaultExecutionUnitParameterNReturn(a: Any): Unit =&gt; MyDefaultReturn = 
  {u : Unit =&gt; a }.andThen(_ =&gt; defaultReturn())
  </code></pre>
  
  <p>However my application would fail if the user implements "a" as a function</p>
  
  <p>So my first idea was something like </p>
  
  <pre><code> implicit def defaultExecutionUnitParameterNReturn[A](a: A)(implicit e : A =!= Function) Unit =&gt; MyDefaultReturn = 
  {u : Unit =&gt; a }.andThen(_ =&gt; defaultReturn())
  </code></pre>
  
  <p>where implicit =!=[A,B] fails if A and B are the same type.
  But "Function" does not exists</p>