Mod_declarationsSourceFor a module, there are five possible situations:
Declare Module M : T then mod_expr = Abstract; mod_type_alg = Some TModule M := E then mod_expr = Algebraic E; mod_type_alg = NoneModule M : T := E then mod_expr = Algebraic E; mod_type_alg = Some TModule M. ... End M then mod_expr = FullStruct; mod_type_alg = NoneModule M : T. ... End M then mod_expr = Struct; mod_type_alg = Some T And of course, all these situations may be functors or not.A module_type_body is just a module_body with no implementation and also an empty mod_retroknowledge. Its mod_type_alg contains the algebraic definition of this module type, or None if it has been built interactively.
A module signature is a structure, with possibly functors on top of it
type module_implementation = | Abstractno accessible implementation
*)| Algebraic of Declarations.module_expressionnon-interactive algebraic expression
*)| Struct of structure_bodyinteractive body living in the parameter context of mod_type
| FullStructspecial case of Struct : the body is exactly mod_type
Extra invariants :
MEwith inside a mod_expr implementation : the 'with' syntax is only supported for module typesMEapply can only be another MEapply or a MEident * the argument of MEapply is now directly forced to be a ModPath.t.None if the argument is a functor, mod_delta otherwise
val make_module_body :
module_signature ->
Mod_subst.delta_resolver ->
Retroknowledge.action list ->
module_bodyval strengthen_module_body :
src:Names.ModPath.t ->
module_signature ->
Mod_subst.delta_resolver ->
module_body ->
module_bodyval strengthen_module_type :
structure_body ->
Mod_subst.delta_resolver ->
module_type_body ->
module_type_bodyval replace_module_body :
structure_body ->
Mod_subst.delta_resolver ->
module_body ->
module_bodyval set_algebraic_type :
module_type_body ->
Declarations.module_expression ->
module_type_bodyval subst_signature :
subst_kind ->
Mod_subst.substitution ->
Names.ModPath.t ->
module_signature ->
module_signatureval subst_structure :
subst_kind ->
Mod_subst.substitution ->
Names.ModPath.t ->
structure_body ->
structure_bodyval subst_module :
subst_kind ->
Mod_subst.substitution ->
Names.ModPath.t ->
module_body ->
module_bodyval subst_modtype :
subst_kind ->
Mod_subst.substitution ->
Names.ModPath.t ->
module_type_body ->
module_type_bodyFor instance: functor(X:T)->struct module M:=X end) becomes: functor(X:T)->struct module M:=<content of T> end)