···3232$ dune build @doc
3333]}
34343535-and the results will be in [_build/default/_doc/_html/].
3535+The results will be in [_build/default/_doc/_html/].
36363737{1:library_wrapping Dune's Library Wrapping}
38383939Dune has a feature whereby a library may be exposed under a single top-level
4040-module. This makes use of an OCaml feature where the use of the compiler
4141-flag [-no-alias-deps] is used to avoid introducing dependencies between
4040+module. This employs an OCaml feature where using the compiler
4141+flag [-no-alias-deps] will avoid introducing dependencies between
4242compilation units.
43434444We aim to reduce the potential name clashes of modules by
4545-only exposing one main module for library users to use,
4545+only exposing one main module for library users,
4646encapsulating all other modules as submodules, while
4747still retaining the usual way of writing OCaml code with one module per
4848-file. These individual files are still compiled, and installed, and
4848+file. These individual files are still compiled, installed, and
4949available in the global namespace, but their names are prefixed with
5050the library's name in order to reduce the possibility of clashes. These
5151prefixed modules are not intended to be used directly, so
···9494[Lib] is linked, and during this process, the
9595the modules [A] and [B] are expanded because they are aliases of hidden
9696modules. All references to [Lib__A] and [Lib__B] are replaced with the canonical
9797-paths [Lib.A] and [Lib.B], so in this way odoc presents the library as entirely
9797+paths [Lib.A] and [Lib.B], so in this way, [odoc] presents the library as entirely
9898contained within the module [Lib].
9999100100{2 Hand-Written Top-Level Module}
101101102102In some cases it's desirable to hand-write the top-level library module. This
103103-is usually done because some of the modules within the library are intended to
104104-be internal only and not exposed. Dune will notice that a module exists with
105105-the name of the library ([lib.ml] in this case), so instead it will create the
106106-file [lib__.ml]. The contents of this are identical to the previous section,
107107-with aliases for all modules. The canonical tags on the aliases are, as before,
108108-to [Lib.A] and [Lib.B]. These are references to module aliases that should be
109109-present in [lib.ml]. If these are {e not} there, [odoc] won't be able to
110110-resolve the canonical references, and any items from these modules that are
111111-exposed elsewhere will be hidden. If the items are type aliases they can be
112112-replaced, but otherwise they'll be rendered as unresolved links.
103103+is usually done because some modules in the library are intended to be internal
104104+only and not exposed. Dune will notice that a module exists with the library's
105105+name ([lib.ml] in this case), so instead it will create the file
106106+[lib__.ml]. Its contents are identical to the previous section, with aliases
107107+for all modules. Like before, the canonical tags on these aliases are
108108+references to [Lib.A] and [Lib.B]. These module should be present in [lib.ml]
109109+as module aliases. If these are {e not} there, [odoc] won't be able to resolve
110110+the canonical references, and any items from these modules that are exposed
111111+elsewhere will be hidden. If the items are type aliases, they can be replaced,
112112+but otherwise they'll be rendered as unresolved links.
113113114114For example, consider the following module structure. First, the module [Unexposed]
115115in file [unexposed.mli]:
···130130val f : Unexposed.t
131131]}
132132133133-and the library module that only exposes the module [Wrapping]:
133133+The library module that only exposes the module [Wrapping]:
134134135135{[
136136module Wrapping = Wrapping
137137]}
138138139139-This structure is rendered {{!Odoc_examples.Wrapping}here}.139139+This structure is rendered {{!Odoc_examples.Wrapping}here}.