title: F# polymorphic types
body: <p>The following works fine, as one would expect in a Curry style polymorphic type system where e.g. the identity function is actually an infinite family of functions, one for each type 'a -> 'a:</p>
  
  <pre><code>let f x = x
  printfn "%A" (f 2)
  printfn "%A" (f 3.4)
  </code></pre>
  
  <p>But when we try to do something a little more complex, it fails on the third line, "this expression was expected to have type int but here has type float":</p>
  
  <pre><code>let f x = string x
  printfn "%A" (f 2)
  printfn "%A" (f 3.4)
  </code></pre>
  
  <p>(But commenting out the second line makes the third line work, as expected.)</p>
  
  <p>A priori, I would have expected type inference to either behave Curry style where an unspecified type is effectively a generic, or else to lock down just one version of the function, but as far as I can see, it's doing the former in the first case and the latter in the second case. I'm guessing there's some logic behind the behavior that I'm just not picking up. What am I missing?</p>