Module Mod_declarations

type 'a generic_module_body

For a module, there are five possible situations:

A module_type_body is just a module_body with no implementation. 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 =
  1. | Abstract
    (*

    no accessible implementation

    *)
  2. | Algebraic of Declarations.module_expression
    (*

    non-interactive algebraic expression

    *)
  3. | Struct of Mod_subst.delta_resolver * structure_body
    (*

    interactive body living in the parameter context of mod_type

    *)
  4. | FullStruct
    (*

    special case of Struct : the body is exactly mod_type

    *)

Extra invariants :

Accessors
val mod_type_alg : 'a generic_module_body -> Declarations.module_expression option
val mod_global_delta : 'a generic_module_body -> Mod_subst.delta_resolver option

None if the argument is a functor, mod_delta otherwise

Builders
val module_type_of_module : module_body -> module_type_body
val module_body_of_type : module_type_body -> module_body
val functorize_module : (Names.MBId.t * module_type_body) list -> module_body -> module_body
Setters
val set_implementation : module_implementation -> module_body -> module_body
Substitution
type subst_kind
val subst_codom : subst_kind
val subst_dom_codom : subst_kind
Hashconsing
val hcons_generic_module_body : 'a generic_module_body -> 'a generic_module_body
val hcons_module_body : module_body -> module_body
val hcons_module_type : module_type_body -> module_type_body
Cleaning a module expression from bounded parts

For instance: functor(X:T)->struct module M:=X end) becomes: functor(X:T)->struct module M:=<content of T> end)

val clean_structure : Names.MBId.Set.t -> structure_body -> structure_body