title: Explain ML type inference to a C++ programmer
body: <p>How does ML perform the type inference in the following function definition:</p>
  
  <pre><code>let add a b = a + b
  </code></pre>
  
  <p>Is it like C++ templates where no type-checking is performed until the point of template instantiation after which if the type supports the necessary operations, the function works or else a compilation error is thrown ?</p>
  
  <p>i.e. for example, the following function template</p>
  
  <pre><code>template &lt;typename NumType&gt;
  NumType add(NumType a, NumType b) {
    return a + b;
  }
  </code></pre>
  
  <p>will work for</p>
  
  <pre><code>add&lt;int&gt;(23, 11);
  </code></pre>
  
  <p>but won't work for</p>
  
  <pre><code>add&lt;ostream&gt;(cout, fout);
  </code></pre>
  
  <p>Is what I am guessing is correct or ML type inference works differently?</p>
  
  <p>PS: Sorry for my poor English; it's not my native language.</p>