package ocamlformat-lib
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=031494ab770cef10a8f6aa1cbeb5660e46c3aa6c0cd457b110fec859a75e877d
sha512=35c0131f04c2c8ceb94f0f400e4b56690405ddebb482aec0c9962163001d9fd5b593455df08b508394949f2740ba28f1714dff9e1f17b618bdec62fd26fae281
doc/ocamlformat-lib.ocaml_common/Ocaml_common/Longident/index.html
Module Ocaml_common.Longident
Source
Long identifiers, used in parsetree.
Warning: this module is unstable and part of compiler-libs.
To print a longident, see Pprintast.longident
, using Format.asprintf
to convert to a string.
For a non-empty list l
, unflatten l
is Some lid
where lid
is the long identifier created by concatenating the elements of l
with Ldot
. unflatten []
is None
.
This function is broken on identifiers that are not just "Word.Word.word"; for example, it returns incorrect results on infix operators and extended module paths.
If you want to generate long identifiers that are a list of dot-separated identifiers, the function unflatten
is safer and faster. unflatten
is available since OCaml 4.06.0.
If you want to parse any identifier correctly, use the long-identifiers functions from the Parse
module, in particular Parse.longident
. They are available since OCaml 4.11, and also provide proper input-location support.