Dear OCaml module hackers,
the recently polished "substitution inside type signature" (described in Sec 8.11 in the manual) is a real improvement to modularize module signature developments.
Yet, it seems to me that "include" at the level of module implementations is preventing us to unleash the full composability power of "include" at the level of signature. Consider the following example:
``
module type A = sig type t end
module type B = sig type t end
type u = U
module AI : A with type t = u = struct
type t = u
end
module BI : B with type t = u = struct
type t = u
end
module ABI : sig
include A
include B with type t := t
end = struct
include AI
include BI (* This include unfortunately triggers:
Error: Multiple definition of the type name t.
Names must be unique in a given structure or signature.
*)
end
``
I have two questions:
Would it make sense to allow module implementation inclusion to introduce multiple definitions of a given type name as long as these definitions are equivalent?
Is there an idiom to work around this (apparent) limitation?
Cheers,
--