There ARCHI no Add declaration in ARCHI . The Add M constructor must be written M.Add . In addition, as Ashish Agarwal already noted, the ARCHI module may accept an argument that does not have an Add constructor, since the MOD signature does not mention a constructor named Add .
If you want to use Add in M , you must declare it when you declare M , i.e. in an argument to the constructor. One way to do this is to completely specify the type op in the MOD signature:
module type MOD = sig type operand type op = Add of operand * operand| Sub of operand * operand val print : op -> string end;;
If you use the MOD signature for other purposes, where the type op must remain abstract, there is a notation for adding type equivalents to the signature. With the original definition of MOD you can write
module type MOD_like_M1 = MOD with type op = Add of operand * operand| Sub of operand * operand module ARCHI = functor (M : MOD_like_M1) -> β¦
or
module type MOD_like_M1 = MOD with type op = M1.op module ARCHI = functor (M : MOD_like_M1) -> β¦
or
module type MOD_like_M1 = MOD with type op = Add of operand * operand| Sub of operand * operand module ARCHI = functor (M : MOD with type op = M1.op) -> β¦
In any case, in the definition of ARCHI you need to open M or write M.Add .
source share