I have a specific need, I would like to extend a type where in simple terms:
module A = {
type t;
type body('a) = {.
name: string,
contents: 'a
};
make: unit => t;
};
module B = {
type t('a) = A.t;
type body('a) = {.
surname: string
};
make: unit => t('a);
};
type body in the module B would be extended by the surname
field in the module B. What is the way to do this?
In the newer OCaml this seems to be possible via extension types:
Module A = struct
type foo = Hey
end
Module B = struct
type foo += Ho
end