Ast_helper.Ctf(3)
π NAME
okay so bestie, welcome to Ast_helper.Ctf β it's literally Class type fields, and it's the whole entire vibe of this page. no cap. π¦
π Module
the module is Ast_helper.Ctf, full stop, periodt. that's the address, that's the vibe, that's where you're at. π
β¨ Documentation
so like, here's the tea: this module is a sig, as in:
Module Ctf
: sig end
and what it does β Class type fields β is give you little helpers for building class type field nodes in the OCaml AST. it's giving backstage-pass-to-the-parsetree energy, and honestly? iconic. π
here's every single one of them, in order, no skipping, we don't do that here:
π mk
val mk : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
?docs:Docstrings.docs -> Parsetree.class_type_field_desc ->
Parsetree.class_type_field
the main-character constructor fr fr. you hand it a Parsetree.class_type_field_desc and you get a Parsetree.class_type_field back. optionally you can pass ?loc (an Ast_helper.loc), ?attrs (an Ast_helper.attrs), and ?docs (a Docstrings.docs) if you're feeling fancy. π
πΈ attr
val attr : Parsetree.class_type_field -> Parsetree.attribute ->
Parsetree.class_type_field
slap an attribute onto an existing Parsetree.class_type_field and get the new Parsetree.class_type_field back. it's the little glow-up button. β¨
π¦ inherit_
val inherit_ : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Parsetree.class_type -> Parsetree.class_type_field
takes a Parsetree.class_type and turns it into a Parsetree.class_type_field β the inherit of the class-type world. optional ?loc ( Ast_helper.loc ) and ?attrs ( Ast_helper.attrs ) as always, bestie. note the trailing underscore, she's not plain inherit because OCaml said so. π
π₯ val_
val val_ : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Ast_helper.str -> Asttypes.mutable_flag -> Asttypes.virtual_flag ->
Parsetree.core_type -> Parsetree.class_type_field
okay so this one's stacked: optional ?loc ( Ast_helper.loc ), optional ?attrs ( Ast_helper.attrs ), then an Ast_helper.str, an Asttypes.mutable_flag, an Asttypes.virtual_flag, and a Parsetree.core_type, and out comes a Parsetree.class_type_field. four required args, no skimping. also yes, trailing underscore again. π
π method_
val method_ : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Ast_helper.str -> Asttypes.private_flag -> Asttypes.virtual_flag ->
Parsetree.core_type -> Parsetree.class_type_field
same shape as val_ but make it method β optional ?loc ( Ast_helper.loc ), optional ?attrs ( Ast_helper.attrs ), an Ast_helper.str, an Asttypes.private_flag (different flag! not mutable, private!), an Asttypes.virtual_flag, and a Parsetree.core_type, producing a Parsetree.class_type_field. reading comprehension check passed, slay. π
π constraint_
val constraint_ : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Parsetree.core_type -> Parsetree.core_type -> Parsetree.class_type_field
two Parsetree.core_types walk into a bar, plus optional ?loc ( Ast_helper.loc ) and ?attrs ( Ast_helper.attrs ), and out comes a Parsetree.class_type_field. yes it's constraint_ with the underscore, we've been through this. π
β extension
val extension : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Parsetree.extension -> Parsetree.class_type_field
takes a Parsetree.extension, plus the usual optional ?loc ( Ast_helper.loc ) and ?attrs ( Ast_helper.attrs ), and gives you a Parsetree.class_type_field. extension nodes stay winning. π§
π attribute
val attribute : ?loc:Ast_helper.loc -> Parsetree.attribute ->
Parsetree.class_type_field
note the difference from attr above, bestie β this one builds a Parsetree.class_type_field out of a Parsetree.attribute, with an optional ?loc ( Ast_helper.loc ). no ?attrs here. don't mix them up or I will cry. π
π text
val text : Docstrings.text -> Parsetree.class_type_field list
takes a Docstrings.text and gives you back a list of Parsetree.class_type_field β yes a whole list, because one field was never enough for this queen. πΈ
lowkey important reminder: every signature above is copied character for character β the?loc:Ast_helper.loc, the?attrs:Ast_helper.attrs, the?docs:Docstrings.docsonmk, all of theAsttypes.mutable_flag/Asttypes.private_flag/Asttypes.virtual_flagbusiness, theAst_helper.str, theParsetree.core_type,Parsetree.extension,Parsetree.attribute,Docstrings.text, andParsetree.class_type_field list. nothing dropped, nothing "cleaned up". π«Ά
that's the whole page, bestie β no SEE ALSO, no env vars, no exit codes, just pure class-type-field helper energy. this manual page came from OCamldoc, dated 2026-06-22, so go forth and construct your Parsetree.class_type_fields with main character confidence. πβ¨π
π¦ 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