package MlFront_Core

  1. Overview
  2. Docs

Module MlFront_Core.ModuleIdSource

A ModuleId identifies a module that a developer can create on the file system (aka. a "compilation unit").

It is slightly different from a PackageId which is what a developer can type to refer to a module. See PackageId for a Venn Diagram.

Sourcetype state =
  1. | Standard of StandardModuleId.t
  2. | Special of SpecialModuleId.t
Sourcetype t = private {
  1. library_id : LibraryId.t;
    (*

    The library the module belongs to.

    *)
  2. namespace_front : string list;
    (*

    The front of the namespace; that is, all but the last terms of the namespace. Each term in the front of the namespace must adhere to the STANDARD NAMESPACE TERM validation rules.

    *)
  3. namespace_tail : string;
    (*

    The last term of the namespace. For the Standard subtype, the last term must adhere to the STANDARD NAMESPACE TERM validation rules. For the Special subtype, the last term must not validate with the STANDARD NAMESPACE TERM rules; in fact, the last term must be one of the "special" words.

    *)
  4. state : state;
}

t is the representation of the module identity.

Sourceval pp : Format.formatter -> t -> unit
Sourceval compare : t -> t -> int
Sourceval of_standard_module_id : StandardModuleId.t -> t
Sourceval of_special_module_id : SpecialModuleId.t -> t
Sourceval create_standard : library_id:LibraryId.t -> namespace_front:string list -> namespace_tail:string -> t

create_standard ~library_id ~namespace_front ~namespace_tail creates an id for a standard module of the library library at the non-empty namespace namespace_front @ [namespace_tail].

Sourceval create_standard_optimistic : library_id:LibraryId.t -> namespace_front:string list -> namespace_tail:string -> optimistic:StandardModuleId.optimistic -> t

create_standard_implict ~library_id ~module_path ~optimistic creates an optimistic id for a standard module of the library library_id at the non-empty namespace namespace_front @ [namespace_tail].

Throws Invalid_argument when there are validation problems.

Sourceval create_signature : library_id:LibraryId.t -> t

create_signature ~library creates a lib__ module id for the library library.

Sourceval create_libopen : library_id:LibraryId.t -> t

create_libopen ~library creates a open__ module id for the library library.

Sourceval create_proxy_of_standard_module_id : StandardModuleId.t -> t
Sourceval is_standard : t -> bool

is_standard module_id is true if and only if the id is for a standard module.

Sourceval is_standard_explicit : t -> bool

is_standard_explicit module_id is true if and only if the id is for a standard, explicit module.

Sourceval is_libcontrol : t -> bool

is_libcontrol is true if and only if the id is for a lib__ module.

Sourceval is_libopen : t -> bool

is_libopen is true if and only if the id is for a open__ module.

Sourceval namespace_front : t -> string list

The front of the namespace namespace_front module_id is all but the last term in the namespace.

A SpecialModuleId.typ.SignatureModule's and SpecialModuleId.typ.LibOpenModule's front of the namespace is empty.

Sourceval namespace_tail : t -> string

namespace_tail module_id is the last term in the namespace.

A SpecialModuleId.typ.SignatureModule's tail of the namespace is ModuleParsing.signature_simple_name. A SpecialModuleId.typ.LibOpenModule's tail of the namespace is ModuleParsing.libopen_simple_name.

Sourceval namespace_ : t -> string list

namespace_ module_id is all the terms of the namespace of module_id.

Sourceval full_name : t -> string

full_name module_id returns a string with the library concatenated with a dot (.) and then concatenated with the module id path seperated by dots.

If the module is a libcontrol module then the module id path is "<name of library>'".

Sourceval pp_full_name : Format.formatter -> t -> unit

pp_full_name ppf module_id prints on the pretty printer ppf a string with the library concatenated with a dot (.) and then concatenated with the module id path seperated by dots.

If the module is a libcontrol module then the module id path is "<name of library>'".

Sourceval show_double_underscore : t -> string

show_underscore module_id returns a string with the library followed by a double underscore and then the modules in the module id path seperated by double underscores.

If the module is a libcontrol module then the module id path is "<name of library>'".

Sourceval library_id : t -> LibraryId.t

Casting

The downcast of PackageId and ModuleId is StandardModuleId. Use StandardModuleId.downcast_package_id if you need that down casting. Confer with the Venn diagram in PackageId.

Sourceval cast_as_unit_id : t -> [ `PackageId of PackageId.t | `SpecialModuleId of SpecialModuleId.t ]

cast_as_unit_id module_id is the module module_id upcast to a UnitId.t.

Sourceval downcast_unit_id : [ `PackageId of PackageId.t | `SpecialModuleId of SpecialModuleId.t ] -> t option

downcast_package_id unit_id tries to convert the unit identifier unit_id to a module id.

Sourceval downcast_special_id_as_proxy_standard_id : SpecialModuleId.t -> StandardModuleId.t option

downcast_special_id_as_proxy_standard_id special_module_id tries to convert the special module id special_module_id to a standard module id.