title: Redundancy in OCaml type declaration (ml/mli)
body: <p>I'm trying to understand a specific thing about ocaml modules and their compilation:</p>
  
  <p>am I forced to redeclare types already declared in a <code>.mli</code> inside the specific <code>.ml</code> implementations?</p>
  
  <p>Just to give an example:</p>
  
  <pre><code>(* foo.mli *)
  type foobar = Bool of bool | Float of float | Int of int
  
  (* foo.ml *)
  type baz = foobar option
  </code></pre>
  
  <p>This, according to my normal way of thinking about interfaces/implementations, should be ok but it says</p>
  
  <blockquote>
    <p>Error: Unbound type constructor foobar</p>
  </blockquote>
  
  <p>while trying to compile with</p>
  
  <pre><code>ocamlc -c foo.mli
  ocamlc -c foo.ml
  </code></pre>
  
  <p>Of course the error disappears if I declare <code>foobar</code> inside <code>foo.ml</code> too but it seems a complex way since I have to keep things synched on every change.</p>
  
  <p>Is there a way to avoid this redundancy or I'm forced to redeclare types every time?</p>
  
  <p>Thanks in advance</p>