type level integers in ocaml
Could anyone give me suggestions/advice on making type level integers in OCaml (3.12) supporting addition and subtraction operations on them? For example, if I have numbers represented like this: type zero type 'a succ type pos1 = zero succ type pos2 = zero succ succ ... I need a way to define function on types like this: val add: pos2 -> pos1 -> pos3 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