title: Trouble exporting curried generic function
body: <p>I have a library of helper functions that I want to export curried versions of. </p>
  
  <p>A small chunk of it looks like this:</p>
  
  <pre><code>export function curry2&lt;A,B,C&gt;(f: (x: A, y: B) =&gt; C): (x: A) =&gt; (y: B) =&gt; C {
    return (a) =&gt; (b) =&gt; f(a, b)
  }
  
  function _push&lt;A&gt;(item: A, items: Array&lt;A&gt;): Array&lt;A&gt; {
    return items.concat(item)
  }
  
  export const push = curry2(push)
  </code></pre>
  
  <p>But that doesn't work. Flow complains expression <code>curry2(push)</code>, saying:</p>
  
  <pre><code>- type parameter 'A' of function call. Missing annotation.
  - type parameter 'B' of function call. Missing annotation.
  </code></pre>
  
  <p>So I tried to fix this by annotating the exported identifier:</p>
  
  <pre><code>export const push&lt;A&gt;: (item: A) =&gt; (items: Array&lt;A&gt;) =&gt; Array&lt;A&gt;
  </code></pre>
  
  <p>But this doesn't work because <code>const</code> expressions can't introduce generic type variables.</p>
  
  <p>So I figured I would have to export an actual function in order to be able to annotate it:</p>
  
  <pre><code>export function push&lt;A&gt; (item: A): (items: Array&lt;A&gt;) =&gt; Array&lt;A&gt; {
    return curry2(_push)(item);
  }
  </code></pre>
  
  <p>But at this point I'm basically going to re-write a big chunk of curry for each function I want to export.</p>
  
  <p>Is there a better way to help Flow fill in the generic type variables of exports in const expressions?</p>