Ast_helper.Typ(3)
π Ast_helper.Typ(3) π
okay so bestie, this is Ast_helper.Typ(3) from the OCaml library, and it's literally the type-expression helper module β think "build me a Parsetree.core_type without crying" energy π«Ά. We're gonna go through every single val together, no skipping, because that's the whole vibe. β¨
πΈ NAME πΈ
Ast_helper.Typ β Type expressions π
π§ Module π§
Module Ast_helper.Typ β yes bestie, that's the module we're in.
Module Typ
: sig end
π Documentation π
β¨ Module Typ β¨
Type expressions β iconic, honestly.
π mk
gives you a Parsetree.core_type from a Parsetree.core_type_desc, with optional ?loc:Ast_helper.loc and ?attrs:Ast_helper.attrs. Signature check:
val mk : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Parsetree.core_type_desc -> Parsetree.core_type
π attr
takes a Parsetree.core_type and a Parsetree.attribute, and hands you back a Parsetree.core_type. Lowkey a little glow-up for your type.
val attr : Parsetree.core_type -> Parsetree.attribute ->
Parsetree.core_type
π any
optional ?loc:Ast_helper.loc and ?attrs:Ast_helper.attrs, then a unit β yes, unit -> ..., it's giving thunk energy β and you get a Parsetree.core_type.
val any : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs -> unit ->
Parsetree.core_type
π var
optional ?loc:Ast_helper.loc and ?attrs:Ast_helper.attrs, then a string, and out comes a Parsetree.core_type. cute.
val var : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs -> string ->
Parsetree.core_type
π arrow
optional ?loc:Ast_helper.loc and ?attrs:Ast_helper.attrs, then an Asttypes.arg_label, then two Parsetree.core_types, and you get a Parsetree.core_type back. arrow behavior, no cap.
val arrow : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Asttypes.arg_label -> Parsetree.core_type -> Parsetree.core_type ->
Parsetree.core_type
π tuple
optional ?loc:Ast_helper.loc and ?attrs:Ast_helper.attrs, then a list of (string option * Parsetree.core_type) pairs, and you get a Parsetree.core_type. tuple said periodt.
val tuple : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs -> (string
option * Parsetree.core_type) list -> Parsetree.core_type
π constr
optional ?loc:Ast_helper.loc and ?attrs:Ast_helper.attrs, then an Ast_helper.lid and a Parsetree.core_type list, returning a Parsetree.core_type.
val constr : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Ast_helper.lid -> Parsetree.core_type list -> Parsetree.core_type
π object_
optional ?loc:Ast_helper.loc and ?attrs:Ast_helper.attrs, then a Parsetree.object_field list, then an Asttypes.closed_flag, and you get a Parsetree.core_type. object core, honestly.
val object_ : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Parsetree.object_field list -> Asttypes.closed_flag ->
Parsetree.core_type
π class_
optional ?loc:Ast_helper.loc and ?attrs:Ast_helper.attrs, then an Ast_helper.lid and a Parsetree.core_type list, returning a Parsetree.core_type.
val class_ : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Ast_helper.lid -> Parsetree.core_type list -> Parsetree.core_type
π alias
optional ?loc:Ast_helper.loc and ?attrs:Ast_helper.attrs, then a Parsetree.core_type and a string Ast_helper.with_loc, returning a Parsetree.core_type.
val alias : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Parsetree.core_type -> string Ast_helper.with_loc -> Parsetree.core_type
π variant
optional ?loc:Ast_helper.loc and ?attrs:Ast_helper.attrs, then a Parsetree.row_field list, an Asttypes.closed_flag, and an Asttypes.label list option, returning a Parsetree.core_type.
val variant : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Parsetree.row_field list -> Asttypes.closed_flag -> Asttypes.label list
option -> Parsetree.core_type
π poly
optional ?loc:Ast_helper.loc and ?attrs:Ast_helper.attrs, then an Ast_helper.str list and a Parsetree.core_type, returning a Parsetree.core_type.
val poly : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Ast_helper.str list -> Parsetree.core_type -> Parsetree.core_type
π package
optional ?loc:Ast_helper.loc and ?attrs:Ast_helper.attrs, then a Parsetree.package_type, returning a Parsetree.core_type.
val package : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Parsetree.package_type -> Parsetree.core_type
π open_
optional ?loc:Ast_helper.loc and ?attrs:Ast_helper.attrs, then an Ast_helper.lid and a Parsetree.core_type, returning a Parsetree.core_type.
val open_ : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Ast_helper.lid -> Parsetree.core_type -> Parsetree.core_type
π extension
optional ?loc:Ast_helper.loc and ?attrs:Ast_helper.attrs, then a Parsetree.extension, returning a Parsetree.core_type.
val extension : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Parsetree.extension -> Parsetree.core_type
π functor_
optional ?loc:Ast_helper.loc and ?attrs:Ast_helper.attrs, then an Asttypes.arg_label, an Ast_helper.str, a Parsetree.package_type, and a Parsetree.core_type, returning a Parsetree.core_type. functor core, slay.
val functor_ : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Asttypes.arg_label -> Ast_helper.str -> Parsetree.package_type ->
Parsetree.core_type -> Parsetree.core_type
π force_poly
takes a Parsetree.core_type and returns a Parsetree.core_type. short, sweet, iconic.
val force_poly : Parsetree.core_type -> Parsetree.core_type
π varify_constructors
val varify_constructors : Ast_helper.str list -> Parsetree.core_type ->
Parsetree.core_type
varify_constructors newtypes te is type expression te, of which any of nullary type constructor tc is replaced by type variable of the same name, if tc's name appears in newtypes. Raise Syntaxerr.Variable_in_scope if any type variable inside te appears in newtypes.
π¨ technical caveat, bestie: it really does raise Syntaxerr.Variable_in_scope in that case. not a drill.
Since 4.05
π package_type
optional ?loc:Ast_helper.loc and ?attrs:Ast_helper.attrs, then an Ast_helper.lid and a list of (Ast_helper.lid * Parsetree.core_type) pairs, returning a Parsetree.package_type.
val package_type : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Ast_helper.lid -> (Ast_helper.lid * Parsetree.core_type) list ->
Parsetree.package_type
Since 5.4
this iconic little page was brought to you by OCamldoc on 2026-06-22 π go build some type expressions, bestie, you got this πβ¨
π¦ where this page comes from
- arch rolling: ocaml 5.5.0-1 Β· LGPL2.1 AND custom: QPL-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms