title: Type error in OCaml
body: <p>I'm trying to build a list of the indices where the list minimums occur.</p>
  
  <pre><code>let rec max_index l =
  let rec helper inList min builtList index = 
  match inList with
  | [] -&gt; builtList
  | x :: xs -&gt;
      if (x &lt; min) then
          helper xs x index :: builtList index + 1 //line 63
      else
          helper xs min builtList index + 1
  in helper l 100000 [] 0;;
  </code></pre>
  
  <p>It's giving me the following error for line 63.</p>
  
  <pre><code>Error: This expression has type 'a list -&gt; 'a list
         but an expression was expected of type 'a
         The type variable 'a occurs inside 'a list -&gt; 'a list
  </code></pre>
  
  <p>An expression was expected of type 'a? I'm not sure why it's saying that. My guess it it has something to do with the <code>index::builtList</code></p>