package ocaml-base-compiler

  1. Overview
  2. Docs

Representation and manipulation of modules and module types.

Types

type module_element = Odoc_module.module_element =
  1. | Element_module of t_module
  2. | Element_module_type of t_module_type
  3. | Element_included_module of included_module
  4. | Element_class of Class.t_class
  5. | Element_class_type of Class.t_class_type
  6. | Element_value of Value.t_value
  7. | Element_type_extension of Extension.t_type_extension
  8. | Element_exception of Exception.t_exception
  9. | Element_type of Type.t_type
  10. | Element_module_comment of text

To keep the order of elements in a module.

and mmt = Odoc_module.mmt =
  1. | Mod of t_module
  2. | Modtype of t_module_type

Used where we can reference t_module or t_module_type.

and included_module = Odoc_module.included_module = {
  1. im_name : Name.t;
    (*

    Complete name of the included module.

    *)
  2. mutable im_module : mmt option;
    (*

    The included module or module type, if we found it.

    *)
  3. mutable im_info : Odoc_types.info option;
    (*

    comment associated to the includ directive

    *)
}
and module_alias = Odoc_module.module_alias = {
  1. ma_name : Name.t;
    (*

    Complete name of the target module.

    *)
  2. mutable ma_module : mmt option;
    (*

    The real module or module type if we could associate it.

    *)
}
and module_parameter = Odoc_module.module_parameter = {
  1. mp_name : string;
    (*

    the name

    *)
  2. mp_type : Types.module_type option;
    (*

    the type

    *)
  3. mp_type_code : string;
    (*

    the original code

    *)
  4. mp_kind : module_type_kind;
    (*

    the way the parameter was built

    *)
}
and module_kind = Odoc_module.module_kind =
  1. | Module_struct of module_element list
    (*

    A complete module structure.

    *)
  2. | Module_alias of module_alias
    (*

    Complete name and corresponding module if we found it

    *)
  3. | Module_functor of module_parameter * module_kind
    (*

    A functor, with its parameter and the rest of its definition

    *)
  4. | Module_apply of module_kind * module_kind
    (*

    A module defined by application of a functor.

    *)
  5. | Module_with of module_type_kind * string
    (*

    A module whose type is a with ... constraint. Should appear in interface files only.

    *)
  6. | Module_constraint of module_kind * module_type_kind
    (*

    A module constraint by a module type.

    *)
  7. | Module_typeof of string
    (*

    by now only the code of the module expression

    *)
  8. | Module_unpack of string * module_type_alias
    (*

    code of the expression and module type alias

    *)

Different kinds of a module.

and t_module = Odoc_module.t_module = {
  1. m_name : Name.t;
    (*

    Complete name of the module.

    *)
  2. mutable m_type : Types.module_type;
    (*

    The type of the module.

    *)
  3. mutable m_info : info option;
    (*

    Information found in the optional associated comment.

    *)
  4. m_is_interface : bool;
    (*

    true for modules read from interface files

    *)
  5. m_file : string;
    (*

    The file the module is defined in.

    *)
  6. mutable m_kind : module_kind;
    (*

    The way the module is defined.

    *)
  7. mutable m_loc : location;
  8. mutable m_top_deps : Name.t list;
    (*

    The toplevels module names this module depends on.

    *)
  9. mutable m_code : string option;
    (*

    The whole code of the module

    *)
  10. mutable m_code_intf : string option;
    (*

    The whole code of the interface of the module

    *)
  11. m_text_only : bool;
    (*

    true if the module comes from a text file

    *)
}

Representation of a module.

and module_type_alias = Odoc_module.module_type_alias = {
  1. mta_name : Name.t;
    (*

    Complete name of the target module type.

    *)
  2. mutable mta_module : t_module_type option;
    (*

    The real module type if we could associate it.

    *)
}
and module_type_kind = Odoc_module.module_type_kind =
  1. | Module_type_struct of module_element list
    (*

    A complete module signature.

    *)
  2. | Module_type_functor of module_parameter * module_type_kind
    (*

    A functor, with its parameter and the rest of its definition

    *)
  3. | Module_type_alias of module_type_alias
    (*

    Complete alias name and corresponding module type if we found it.

    *)
  4. | Module_type_with of module_type_kind * string
    (*

    The module type kind and the code of the with constraint.

    *)
  5. | Module_type_typeof of string
    (*

    by now only the code of the module expression

    *)

Different kinds of module type.

and t_module_type = Odoc_module.t_module_type = {
  1. mt_name : Name.t;
    (*

    Complete name of the module type.

    *)
  2. mutable mt_info : info option;
    (*

    Information found in the optional associated comment.

    *)
  3. mutable mt_type : Types.module_type option;
    (*

    None means that the module type is abstract.

    *)
  4. mt_is_interface : bool;
    (*

    true for modules read from interface files.

    *)
  5. mt_file : string;
    (*

    The file the module type is defined in.

    *)
  6. mutable mt_kind : module_type_kind option;
    (*

    The way the module is defined. None means that module type is abstract. It is always None when the module type was extracted from the implementation file. That means module types are only analysed in interface files.

    *)
  7. mutable mt_loc : location;
}

Representation of a module type.

Functions for modules

val module_elements : ?trans:bool -> t_module -> module_element list

Access to the elements of a module.

val module_modules : ?trans:bool -> t_module -> t_module list

Access to the submodules of a module.

val module_module_types : ?trans:bool -> t_module -> t_module_type list

Access to the module types of a module.

val module_included_modules : ?trans:bool -> t_module -> included_module list

Access to the included modules of a module.

val module_type_extensions : ?trans:bool -> t_module -> Extension.t_type_extension list

Access to the type extensions of a module.

val module_exceptions : ?trans:bool -> t_module -> Exception.t_exception list

Access to the exceptions of a module.

val module_types : ?trans:bool -> t_module -> Type.t_type list

Access to the types of a module.

val module_values : ?trans:bool -> t_module -> Value.t_value list

Access to the values of a module.

val module_functions : ?trans:bool -> t_module -> Value.t_value list

Access to functional values of a module.

val module_simple_values : ?trans:bool -> t_module -> Value.t_value list

Access to non-functional values of a module.

val module_classes : ?trans:bool -> t_module -> Class.t_class list

Access to the classes of a module.

val module_class_types : ?trans:bool -> t_module -> Class.t_class_type list

Access to the class types of a module.

val module_all_classes : ?trans:bool -> t_module -> Class.t_class list

The list of classes defined in this module and all its submodules and functors.

val module_is_functor : t_module -> bool

true if the module is functor.

val module_parameters : ?trans:bool -> t_module -> (module_parameter * text option) list

The list of couples (module parameter, optional description).

val module_comments : ?trans:bool -> t_module -> text list

The list of module comments.

Functions for module types

val module_type_elements : ?trans:bool -> t_module_type -> module_element list

Access to the elements of a module type.

val module_type_modules : ?trans:bool -> t_module_type -> t_module list

Access to the submodules of a module type.

val module_type_module_types : ?trans:bool -> t_module_type -> t_module_type list

Access to the module types of a module type.

val module_type_included_modules : ?trans:bool -> t_module_type -> included_module list

Access to the included modules of a module type.

val module_type_exceptions : ?trans:bool -> t_module_type -> Exception.t_exception list

Access to the exceptions of a module type.

val module_type_types : ?trans:bool -> t_module_type -> Type.t_type list

Access to the types of a module type.

val module_type_values : ?trans:bool -> t_module_type -> Value.t_value list

Access to the values of a module type.

val module_type_functions : ?trans:bool -> t_module_type -> Value.t_value list

Access to functional values of a module type.

val module_type_simple_values : ?trans:bool -> t_module_type -> Value.t_value list

Access to non-functional values of a module type.

val module_type_classes : ?trans:bool -> t_module_type -> Class.t_class list

Access to the classes of a module type.

val module_type_class_types : ?trans:bool -> t_module_type -> Class.t_class_type list

Access to the class types of a module type.

val module_type_all_classes : ?trans:bool -> t_module_type -> Class.t_class list

The list of classes defined in this module type and all its submodules and functors.

val module_type_is_functor : t_module_type -> bool

true if the module type is functor.

val module_type_parameters : ?trans:bool -> t_module_type -> (module_parameter * text option) list

The list of couples (module parameter, optional description).

val module_type_comments : ?trans:bool -> t_module_type -> text list

The list of module comments.

OCaml

Innovation. Community. Security.