Why doesn't F# Compile Currying into Separate Functions? : <p>So I'm trying to learn F# and as I learn new things I like to look at the IL to see what's happening under the covers. I recently read about Currying, an obvious fundamental of the language. </p>

<p>According to <a href="https://fsharpforfunandprofit.com/posts/currying/">F# for fun and Profit</a> when you create the below function:</p>

<pre><code>let addItems x y = x + y
</code></pre>

<p>What is really happening is there are two single argument functions being created.</p>

<pre><code>let addItems x =
    let subFunction y = 
          x + y
    subFunction
</code></pre>

<p>and when you invoke the function with addItems 5 6 the order of operations are as follows</p>

<ol>
<li><p>addItems is called with argument 5</p></li>
<li><p>addItems returns subFunction</p></li>
<li>subFunction is called with argument 6</li>
<li>subFunction has argument 5 in scope so it adds and returns the sum of 5 and 6</li>
</ol>

<p>All of this sounds fine on the surface. However, when you look at the IL for this it tells a different story. </p>

<pre><code>.method public static int32  testCurry(int32 x,
                                       int32 y) cil managed
{
  .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) 
  // Code size       5 (0x5)
  .maxstack  8
  IL_0000:  nop
  IL_0001:  ldarg.0
  IL_0002:  ldarg.1
  IL_0003:  add
  IL_0004:  ret
} // end of method Sandbox::testCurry
</code></pre>

<p>We can clearly see in the IL that a single static function that takes two arguments and returns an Int32 is created. </p>

<p>So my question is, why the discrepancy? This isn't the first time I've seen IL that doesn't jive with the documentation either... </p>
