title: Scala Functional Literals with Implicits
body: <p>Forgive me if this has already been asked elsewhere.  I have a Scala syntax question involving function-values and implicit parameters.  </p>
  
  <p>I'm comfortable using implicits with Scala's currying feature.  For instance if I had a sum function and wanted to make the second argument an implicit:</p>
  
  <pre><code>scala&gt; def sum(a: Int)(implicit b: Int) = a + b
  sum: (a: Int)(implicit b: Int)Int
  </code></pre>
  
  <p>Is there a way to do this using the function-value syntax?  Ignoring the implicit for a moment, I typically write curried function-values like this:</p>
  
  <pre><code>scala&gt; val sum2 = (a: Int) =&gt; (b: Int) =&gt; a + b
  sum: (Int) =&gt; (Int) =&gt; Int = &lt;function1&gt;
  </code></pre>
  
  <p>However, the function signature in the second approach is much different (the currying is being expressed explicitly).  Just adding the implicit keyword to b doesn't make much sense and the compiler complains as well:</p>
  
  <pre><code>scala&gt; val sum2 = (a: Int) =&gt; (implicit b: Int) =&gt; a + b
  &lt;console&gt;:1: error: '=&gt;' expected but ')' found.
         val sum2 = (a: Int) =&gt; (implicit b: Int) =&gt; a + b
                                                ^
  </code></pre>
  
  <p>Furthermore partially-applying sum from the very first approach to get a function-value causes problems as well:</p>
  
  <pre><code>scala&gt; val sumFunction = sum _
  &lt;console&gt;:14: error: could not find implicit value for parameter b: Int
         val sumFunction = sum _
                           ^
  </code></pre>
  
  <p>This leads me to believe that functions that have implicit parameters must have said parameters determined when the function-value is created, not when the function-value is applied later on.  Is this really the case?  Can you ever use an implicit parameter with a function-value?</p>
  
  <p>Thanks for the help!</p>