title: Haskell : How to build the Heterogeneous Type Any
body: <p>I'd like to build a type to match up to anything but never be used.</p>
  
  <p>Example:</p>
  
  <pre><code>type Any = forall a. a
  f :: (x, Any) -&gt; (Any, y) -&gt; (x,y)
  f (x,_) (_,y) = (x,y)
  </code></pre>
  
  <p>This compiles just fine with <code>{-# LANGUAGE ImpredicativeTypes #-}</code> but if I try</p>
  
  <pre><code>f ("hi", 2) (3, (1, 2))
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>&lt;interactive&gt;:19:9:
      No instance for (Num a) arising from the literal `2'
      Possible fix:
        add (Num a) to the context of a type expected by the context: a
      In the expression: 2
      In the first argument of `f', namely `("hi", 2)'
      In the expression: f ("hi", 2) (3, (1, 2))
  
  &lt;interactive&gt;:19:13:
      No instance for (Num a) arising from the literal `3'
      Possible fix:
        add (Num a) to the context of a type expected by the context: a
      In the expression: 3
      In the second argument of `f', namely `(3, (1, 2))'
      In the expression: f ("hi", 2) (3, (1, 2))
  </code></pre>
  
  <p>Which would be fine if I just wanted x and y to be Num, but what I plan to do with this needs to be much more flexible then that.  I understand that <code>forall a. a</code> matches to all types but can only pass a thunk that can never be computed and bottom.  But, I have no desire to ever look into the Any type.</p>