title: RankNTypes: What is causing this error?
body: <p>I've just been exploring Rank2Types and RankNTypes to try to get familiar with them. But I can't work out why the following does not work.</p>
  
  <pre><code>g :: (forall a. forall b. a -&gt; b) -&gt; x -&gt; y -&gt; (u,v)
  g p x y = (p x, p y)
  </code></pre>
  
  <p>This definition  is accepted by the compiler, but it fails when I try to use it:</p>
  
  <pre><code>ghci&gt; g id 1 2
  
  &lt;interactive&gt;:35:3:
      Couldn't match type `a' with `b'
        `a' is a rigid type variable bound by
            a type expected by the context: a -&gt; b at &lt;interactive&gt;:35:1
        `b' is a rigid type variable bound by
            a type expected by the context: a -&gt; b at &lt;interactive&gt;:35:1
      Expected type: a -&gt; b
        Actual type: a -&gt; a
      In the first argument of `g', namely `id'
      In the expression: g id 1 2
  </code></pre>
  
  <p>I'm struggling to understand why <code>a-&gt;a</code> is not acceptable type for the expected <code>a-&gt;b</code>.</p>