package ocamlformat

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
include module type of Migrate_ast.Longident
include module type of Ocaml_common.Longident
type t =
  1. | Lident of string
  2. | Ldot of t * string
  3. | Lapply of t * t
val flatten : t -> string list
val unflatten : string list -> t option

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.

val last : t -> string
val parse : string -> t

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.

  • deprecated this function may misparse its input, use "Parse.longident" or "Longident.unflatten"

Make a Lident from a dotless string

val is_infix : t -> Ocamlformat_stdlib.bool

Holds for infix identifiers.

val is_hash_getter : t -> Ocamlformat_stdlib.bool

is_hash_getter id returns whether id is considered a hash-getter operator, of the form #**# or #**. where ** can be 0 or more operator chars.

val is_monadic_binding : t -> Ocamlformat_stdlib.bool

is_monadic_binding id returns whether id is a monadic binding operator of the form let** or and** where ** can be 1 or more operator chars.

val field_alias_str : field:t -> Ocamlformat_stdlib.string -> Ocamlformat_stdlib.bool
val field_alias : field:t -> t -> Ocamlformat_stdlib.bool
OCaml

Innovation. Community. Security.