package ocamlformat-lib
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=dc8f2a330ca3930b36cacb2623bb360ed8bdf6e4a8acd293dbd9e2241a6fd33d
sha512=b28f545425fb5375447c90022d065dc7fd51ed2f66d8c1f65a71a6ad2465d039a8686e8f18249e5ad3a2362fee6149c855ef30eb45fb9d06d743a53d26b3e26f
doc/ocamlformat-lib.ocaml_common/Ocaml_common/Longident/index.html
Module Ocaml_common.LongidentSource
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.