title: type level integers in ocaml
body: <p>Could anyone give me suggestions/advice on making type level integers in OCaml (3.12) supporting addition and subtraction operations on them?</p>
  
  <p>For example, if I have numbers represented like this:</p>
  
  <pre><code>type zero
  type 'a succ
  type pos1 = zero succ
  type pos2 =  zero succ succ
  ...
  </code></pre>
  
  <p>I need a way to define function on types like this:</p>
  
  <pre><code>val add: pos2 -&gt; pos1 -&gt; pos3
  </code></pre>
  
  <p>Little background:
  I'm trying to port some haskell code for operations on physical dimensions and i need the ability to define operations on dimension types (record of 7 type level ints representing exponents of 7 basic SI units).
  I need to do it this way to avoid dynamic binding (when using objects) and to enable compiler to evaluate and check all such expressions statically.</p>
  
  <p>My current understanding is that I should make a GADT that implements operations as type constructors, but still I'm struggling with the idea, and any hint would be greatly appreciated.</p>