- Hide value in module
By default, every module, type and value of a module is exported. If you want to hide some of these exports, you must use interfaces. Additionally, interfaces support abstract types (whose internals are hidden).
The convention, borrowed from OCaml, is to use the name t for the main type supported by a module.
-
Importing values from modules
-
Opening modules
-
Including modules: Then all of its exports are added to the exports of the current module.
-
Including interfaces
module type InterfaceA = { ··· }; module type InterfaceB = { include InterfaceA; ··· }module type LogWithDateInterface = { include (module type of Log); /* A */ let logStrWithDate: (t, t) => t; }; module LogWithDate: LogWithDateInterface = { include Log; ··· };
-
-
Namespacing modules
proj/ foo/ NamespaceA.re NamespaceA_Misc.re NamespaceA_Util.re bar/ baz/ NamespaceB.re NamespaceB_Extra.re NamespaceB_Tools.re NamespaceB_Util.re /* NamespaceA.re */ module Misc = NamespaceA_Misc; module Util = NamespaceA_Util;