title: Polymorphic type inside a module (OCaml)
body: <p>I just define a Matrix module as follows:</p>
  
  <pre><code>module Matrix =
    struct
      type element
      type t = element array array
  
      let make (nr: int) (nc: int) (init: element) : t =
        let result = Array.make nr (Array.make nc init) in
        for i = 0 to nr - 1 do
          result.(i) &lt;- Array.make nc init
        done;
        result
    end
  </code></pre>
  
  <p>And <code>let m = Matrix.make 3 4 0</code> gives me an error <code>Error: This expression has type int but an expression was expected of type Matrix.element</code>. Then I added <code>'a</code>:</p>
  
  <pre><code>module Matrix =
    struct
      type element = 'a
      type t = element array array
  
      let make (nr: int) (nc: int) (init: element) : t =
        let result = Array.make nr (Array.make nc init) in
        for i = 0 to nr - 1 do
          result.(i) &lt;- Array.make nc init
        done;
        result
    end
  </code></pre>
  
  <p>The compilation of the module gives an error <code>Error: Unbound type parameter 'a</code>.</p>
  
  <p>Could anyone tell me how to define the type inside of my module?</p>