Ast_helper.Te(3)

πŸ’… Ast_helper.Te(3) β€” like, the OCaml library one, bestie

okay so this is a page from the OCaml library manual (yes, that manual), section 3, and it's about type extensions. no cap, that's the whole vibe. let's get into it πŸ¦‹


✨ NAME ✨

Ast_helper.Te β€” Type extensions πŸ’–

like, literally the type-extensions helper module. that's her. that's the whole job description.


πŸŽ€ Module πŸŽ€

Module Ast_helper.Te

she's a module. she has one job. iykyk.


πŸ‘‘ Documentation πŸ‘‘

Module Te
 : sig end

so yeah, it's a module signature, and the doc page is just… the contents. iconic behaviour honestly.

Type extensions ✨ β€” that's the tagline, that's the brand.


🌸 the vals, in order, do not skip, i am begging

  • val mk β€” takes ?loc:Ast_helper.loc, ?attrs:Ast_helper.attrs, ?docs:Docstrings.docs, ?params:(Parsetree.core_type * (Asttypes.variance * Asttypes.injectivity)) list, ?priv:Asttypes.private_flag, an Ast_helper.lid, and a Parsetree.extension_constructor list β€” and hands you back a Parsetree.type_extension. every arg optional except the lid and the constructor list, main character energy fr.
val mk : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
         ?docs:Docstrings.docs -> ?params:(Parsetree.core_type *
         (Asttypes.variance * Asttypes.injectivity)) list ->
         ?priv:Asttypes.private_flag -> Ast_helper.lid ->
         Parsetree.extension_constructor list -> Parsetree.type_extension
  • val mk_exception β€” the exception-flavoured one 🫢. takes ?loc:Ast_helper.loc, ?attrs:Ast_helper.attrs, ?docs:Docstrings.docs, plus one Parsetree.extension_constructor, and gives you a Parsetree.type_exception. yes bestie, exceptions get their own lil entry point.
val mk_exception : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
         ?docs:Docstrings.docs -> Parsetree.extension_constructor ->
         Parsetree.type_exception
  • val constructor β€” builds a Parsetree.extension_constructor for you πŸ’…. options are ?loc:Ast_helper.loc, ?attrs:Ast_helper.attrs, ?docs:Docstrings.docs, ?info:Docstrings.info, then the required Ast_helper.str and a Parsetree.extension_constructor_kind.
val constructor : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
         ?docs:Docstrings.docs -> ?info:Docstrings.info -> Ast_helper.str ->
         Parsetree.extension_constructor_kind -> Parsetree.extension_constructor
  • val decl β€” also returns a Parsetree.extension_constructor, but this one's got so many optionals, she's highkey the most dressed-up val here 🌈. you've got ?loc:Ast_helper.loc, ?attrs:Ast_helper.attrs, ?docs:Docstrings.docs, ?info:Docstrings.info, ?vars:Ast_helper.str list, ?args:Parsetree.constructor_arguments, ?res:Parsetree.core_type, and then the required Ast_helper.str.
val decl : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
         ?docs:Docstrings.docs -> ?info:Docstrings.info -> ?vars:Ast_helper.str
         list -> ?args:Parsetree.constructor_arguments ->
         ?res:Parsetree.core_type -> Ast_helper.str ->
         Parsetree.extension_constructor
  • val rebind β€” the re-export girlie 🧚. takes ?loc:Ast_helper.loc, ?attrs:Ast_helper.attrs, ?docs:Docstrings.docs, ?info:Docstrings.info, then an Ast_helper.str and an Ast_helper.lid, and returns a Parsetree.extension_constructor.
val rebind : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
         ?docs:Docstrings.docs -> ?info:Docstrings.info -> Ast_helper.str ->
         Ast_helper.lid -> Parsetree.extension_constructor
quick vibe check: every single one of these has ?loc, ?attrs and ?docs hanging out as optionals. that's not me being lazy, that's just the truth. and ?info:Docstrings.info shows up on constructor, decl and rebind but not on mk or mk_exception β€” noticed that? slay, now you'll never unsee it πŸ‘€

πŸ’œ the cute sign-off πŸ’œ

this page was brought to you by OCamldoc, dated 2026-06-22, living in section Ast_helper.Te(3) of the OCaml library manual. stan the tooling, drink some water, go write a type extension. periodt. ⭐πŸ”₯

πŸ“¦ where this page comes from