Consider the following SML program:
signature BinaryOp =
sig
type domain
val operation: (domain * domain) -> domain
end;
signature INTEGER =
sig
val value: int
end;
functor ModularInt(K: INTEGER) :> BinaryOp = (* I *)
struct
type domain = int;
fun operation (a,b) = (a+b) mod K.value;
end;
structure Z3 = ModularInt(struct val value=3 end);
structure Z3' :> BinaryOp = Z3; (* II *)
It turns out that Z3 is not opaque, meaning that Z3.domain is compatible with integers
(i.e., val x: Z3.domain = 0 works), whereas Z3' is opaque.
Why is opaque signature ascription (:>) doing its job on line II but not on line I?