package MlFront_Core

  1. Overview
  2. Docs

Module MlFront_Core.StandardModuleIdSource

A StandardModuleId is-a ModuleId.

Sourcetype optimistic = [
  1. | `StitchedParentModule
]
Sourcetype definition =
  1. | Undetermined
  2. | Explicit
  3. | Optimistic of optimistic
Sourcetype t = private {
  1. library_id : LibraryId.t;
  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. The last term must adhere to the STANDARD NAMESPACE TERM validation rules.

    *)
  4. definition : definition;
    (*

    The definition is not part of compare.

    *)
}

t is the representation of a standard module.

Sourceval pp : Format.formatter -> t -> unit
Sourceval compare : t -> t -> int

compare a b compares the modules a and b while ignoring their definition fields.

Sourceval equal : t -> t -> bool

equal a b is true if the modules a and b are equivalent, ignoring their definition fields.

Sourceval hash : t -> int

hash module_id computes a hash value for the given standard module id, ignoring their definition fields..

Sourceval create_explicit : library_id:LibraryId.t -> namespace_front:string list -> namespace_tail:string -> t

create_explicit ~library_id ~namespace_front ~namespace_tail.

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

create_optimistic ~library_id ~namespace_front ~namespace_tail optimistic.

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

pp_except_library_id ppf t prints the standard module id t to the pretty printer ppf except the library id component.

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

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

Sourceval show_dot : t -> string

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

Sourceval show_dot_except_library_id : t -> string

show_dot_except_library_id module_id returns a string with the module id path seperated by dots. The library_id is not included in the returned string.

Sourceval show_double_underscore : t -> string

show_underscore module_id returns a string with the library concatenated with a double underscore (__) and then concatenated with the module id path seperated by double underscores.

Sourceval show_dash : t -> string

show_dash module_id returns a string with the library concatenated with a dash (-) and then concatenated with the the module id path seperated by dashes.

Sourceval parse : string -> (t, [ `Msg of string ]) result

parse s parses the string s and returns the id for a standard module.

A libcontrol module (ex. "MyLibrary_Std.lib__") and other special modules are not parseable with this standard module function. Library control modules should never leak into end-user code. Instead, use ModuleId.create_signature in the few locations where special modules must be processed.

Accessors

Sourceval library_id : t -> LibraryId.t

library_id module_id is the library the standard module belongs to.

Sourceval namespace_tail : t -> string

namespace_tail module_id is the last name in the namespace.

Sourceval owner_package_id : t -> PackageId.t

owner_package_id t is the parent package of the standard module t.

Example: "DkHello_Std.A.B" returns "DkHello_Std.A".

Casting

Sourceval cast_as_package_id : t -> PackageId.t

cast_as_package_id module_id is the module module_id upcast to a PackageId.t.

It is not the PackageId.t containing the module module_id.

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_package_id : PackageId.t -> t option

downcast_package_id package_id tries to convert the package identifier package_id to a standard module id.

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 standard module id.

Module Suffixes

Module suffixes that are not for user-created MlFront modules.

Modules with these suffixes are not MlFront library modules (ex. "DkHelloScript_Std") or MlFront standard modules (ex. "Example001") or MlFront library control modules ("lib__.ml"). But they can form valid OCaml module names recognized by both ocamlc and Dune.

Sourceval exe : t -> string

exe module_id is the executable name (the filename except .exe) for the module module_id.

Sourceval embed : t -> string

embed module_id is the base name (the filename except .exe) for the embedded bytecode for module module_id.

Sourceval repl : t -> string

repl module_id is the executable name (the filename except .exe) for the REPL for module module_id.

Sourceval exe_suffix : string
Sourceval repl_suffix : string
Sourceval embed_suffix : string

/

Sourcemodule ForAdvancedUse : sig ... end