title: For loop not inferring unsigned integer
body: <p>According to the MSDN documentation on the for ... to loop in F#: </p>
  
  <blockquote>
    <p>The type of the identifier is inferred from the type of the start and finish expressions. Types for these expressions must be 32-bit integers.</p>
  </blockquote>
  
  <p>But, with the code below, I get the following compile-time error:</p>
  
  <pre class="lang-fsharp prettyprint-override"><code>for bar = 0u to 5u do
      let baz : uint32 = bar
      ()
  </code></pre>
  
  <pre class="lang-none prettyprint-override"><code>error FS0001: This expression was expected to have type
      int    
  but here has type
      uint32
  </code></pre>
  
  <p>If I put the loop inside a sequence, though, it compiles without error:</p>
  
  <pre class="lang-fsharp prettyprint-override"><code>let foo =
      seq {
          for bar = 0u to 5u do
              let baz : uint32 = bar
              yield baz
      }
  </code></pre>
  
  <pre class="lang-none prettyprint-override"><code>val foo : seq&lt;uint32&gt;
  </code></pre>
  
  <p>What's going on? <strong>Why does the for-loop infer uint32 in the second example</strong> but not the first?</p>
  
  <p>I have an external library which takes an unsigned 32-bit integer as an index. I need to iterate from 0 to the length of the collection (also uint32) minus one. When I put this logic inside a sequence and yield each item, it compiles without any errors and runs just fine. But when I attempt to read all the items outside a sequence, the compiler bombs. I'm forced to perform type convers from uint32 to int and back again, which, in my opinion, has a very bad smell to it.</p>