For example I have a very abstract logic in module D, which in fact extends concepts of modules A and B, but both should include the same types and functions from module C. Think of A and B as a different versions of the same logic, and D can switch between these two branches on the fly.
I thought about something like this:
module C = struct
type common_struct = {
field1: int;
}
end
module A = struct
include C
let some_func1 _ = () (* Uses type from C *)
end
module B = struct
include C
let some_func2 _ = () (* Uses type from C *)
end
module D = struct
include A
include B
end
But this code obviously throws an error. Are there any solutions for this?