title: Referring to an existential type variable
body: <p>I would like to add type signatures to some local functions in my code.  However, their types involve anonymous, existentially bound type variables.  Since they're anonymous, I don't know how to write a type signature.  How can I refer to such type variables?</p>
  
  <p>In the following example, <code>go</code> has type <code>[b] -&gt; Int -&gt; Int</code>, where <code>b</code> is the type bound by the pattern match <code>T (x_shared:xs) g</code>.  What type signature can I write for it?</p>
  
  <pre class="lang-hs prettyprint-override"><code>data T = forall a. T [a] (a -&gt; a -&gt; Int)
  
  f :: T -&gt; Int
  f (T (x_shared:xs) g) = go xs 0
    where
      -- go :: what type?
      go (x:xs) n = go xs $! n + g x_shared x
      go []     n = n
  </code></pre>