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