title: Is it possible to get the infinite kind error in Haskell 98?
body: <p>I am implementing a kind system for a new functional programming language and I am currently writing the function to unify two kinds. There are four cases two consider:</p>
  
  <pre><code>+---------+---------+-------------------------------------------------------+
  |   k1    |   k2    |                        action                         |
  +=========+=========+=======================================================+
  |   var   |   var   |                  k1 := k2 ^ k2 := k1                  |
  +---------+---------+-------------------------------------------------------+
  |   var   | non var |             if (!occurs(k1, k2)) k1 := k2             |
  +---------+---------+-------------------------------------------------------+
  | non var |   var   |             if (!occurs(k2, k1)) k2 := k1             |
  +---------+---------+-------------------------------------------------------+
  | non var | non var | ensure same name and arity, and unify respective args |
  +---------+---------+-------------------------------------------------------+
  </code></pre>
  
  <ol>
  <li>When both <code>k1</code> and <code>k2</code> are variables then they are instantiated to each other.</li>
  <li>When only <code>k1</code> is a variable then it is instantiated to <code>k2</code> iff <code>k1</code> doesn't occur in <code>k2</code>.</li>
  <li>When only <code>k2</code> is a variable then it is instantiated to <code>k1</code> iff <code>k2</code> doesn't occur in <code>k1</code>.</li>
  <li>Otherwise we check whether <code>k1</code> and <code>k2</code> have the same name and arity, and unify their respective arguments.</li>
  </ol>
  
  <p>For the second and third cases we need to implement the occurs check so that we don't get stuck in an infinite loop. However, I doubt that a programmer will be able to construct an infinite kind at all.</p>
  
  <p>In Haskell, it's easy to construct an infinite type:</p>
  
  <pre><code>let f x = f
  </code></pre>
  
  <p>However, I haven't been able to construct an infinite kind no matter how hard I tried. Note, that I didn't make use of any language extensions.</p>
  
  <p>The reason I am asking this is because if it's not possible to construct an infinite kind at all then I won't even bother implementing the occurs check for kinds in my kind system.</p>