 <p>As for where the error comes from, we have the following type constraints</p> <pre><code>// Cprod: seq&lt;`a&gt; -&gt; seq&lt;`a&gt; -&gt; `a list list let Cprod U V = ... // Cpower: seq&lt;`a&gt; -&gt; int -&gt; ??? let Cpower U n = // V: seq&lt;`a&gt; let mutable V = U // n: int for i=0 to n-1 do (* The next line implies two type constraints: V: seq&lt;`a&gt; V: `a list list *) V &lt;- Dprod U V V </code></pre> <p>That <code>V</code> must be an <code>seq&lt;&#x60;a&gt;</code> and an <code>&#x60;a list list</code>, and that U and V must have the same type means that <code>&#x60;a = &#x60;a list</code>, which is what results in the "infinite type" error message (the infinity type is <code>... list list list list</code>. Even though the value of <code>V</code> is mutable, it must have a single type.</p>