title: OCaml - Error while adding a parametrized function into a module
body: <p>I would like to extend this given definition:</p>
  
  <pre><code>module type StateChart = sig
      type 'a t
      val get : 'a t -&gt; 'a
      val create : 'a -&gt; 'a t
  end
  
  
  module ConcreteStateChart : StateChart = struct
      type 'a t = { state : 'a } (* internal configuration and current state expressed as 'a parameter *)
      let get m = m.state;;   (* obtaining the internal value *) 
      let create x = { state = x };;
  end
  </code></pre>
  
  <p>into two modules where any kind of transaction of type <code>k</code> could be performed. I tried to define the following code, but:</p>
  
  <pre><code>module type StateChart = sig
      type 'a t
      type k
      val get : 'a t -&gt; 'a
      val create : 'a -&gt; 'a t
      val transaction : 'a t -&gt; k -&gt; 'a t
  end
  
  
  module ConcreteStateChart : StateChart = struct
      type 'a t = { state : 'a } (* internal configuration and current state expressed as 'a parameter *)
      type k = 'a option
      let get m = m.state;;   (* obtaining the internal value *) 
      let create x = { state = x };;
      let transaction x y = (* Stupid StateChart that changes the state dependingly to an option parameter *)
          match y with
          | Some z -&gt; { state = z}
          | None -&gt; x;;   
  end
  </code></pre>
  
  <p>it seems that the k definition doesn't remember the <strong>'a</strong> binding performed in <em>'a t</em>:</p>
  
  <blockquote>
    <p>type k = <strong>'a</strong> option;;</p>
    
    <p>Error: Unbound type parameter <strong>'a</strong></p>
  </blockquote>
  
  <p>How could I define such a <em>transaction</em> that could be laterly implemented in a <em>ConcreteStateChart</em> Module? </p>