title: Understand Core's `Fn.const`
body: <p>Jane Street's Core lib has such a function: <code>Fn.const</code>.</p>
  
  <p><a href="https://github.com/janestreet/core_kernel/blob/master/lib/fn.ml" rel="nofollow">https://github.com/janestreet/core_kernel/blob/master/lib/fn.ml</a></p>
  
  <pre><code>let const c = (); fun _ -&gt; c
  </code></pre>
  
  <blockquote>
    <p>val const : 'a -> 'b -> 'a<br>
    produces a function that just returns its first argument</p>
  </blockquote>
  
  <p>I really don't understand it.</p>
  
  <ol>
  <li>What's the purpose of this function? In what scenario we have to use it?</li>
  <li>Why put <code>();</code> first? </li>
  <li>Why not write it as <code>let const c = fun () -&gt; c</code>? this will give a function taking <code>unit</code> as parameter and always returns initial <code>c</code>. </li>
  <li>If I do <code>let f = const 5</code>, <code>f</code> will become a function which takes <code>'_a</code> as parameter. What's the purpose of returning a function with weak polymorphic parameter? </li>
  </ol>
  
  <hr>
  
  <p>p.s. I see that several functions inside <code>Fn</code> module all have <code>();</code> before returning a function, what is the usage of <code>();</code>?</p>