Ast_helper.Cty(3)
π Ast_helper.Cty(3) β like, the class type expressions module bestie
okay so real talk, this is Ast_helper.Cty straight out of the OCaml library manual, and it's the little helper module you reach for when you're building up class type expressions in the parsetree. it's giving "small but mighty" energy and honestly? iconic. β¨
πΈ NAME πΈ
Ast_helper.Cty β Class type expressions. that's it, that's the whole vibe. π
π¦ Module π¦
the module is literally Ast_helper.Cty. yes, the module is named after itself, no cap, that's just how the Ast_helper family rolls π«Ά
β Documentation β
okay so here's the whole deal β this module is declared as
Module Cty
: sig end
and it's all about Class type expressions π no extra surprises hiding in there, it's just the values listed below, slaying one by one. let's go through the whole roster because every single one of them matters:
val mkβ this is the main character constructor π it takes an optional?loc:Ast_helper.loc, an optional?attrs:Ast_helper.attrs, and aParsetree.class_type_desc, and hands you back aParsetree.class_type. the whole signature, verbatim, because i refuse to butcher it:
val mk : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Parsetree.class_type_desc -> Parsetree.class_type
val attrβ slap an attribute on a class type π give it aParsetree.class_typeand aParsetree.attribute, get aParsetree.class_typeback. no optional args here bestie, it's just those two:
val attr : Parsetree.class_type -> Parsetree.attribute ->
Parsetree.class_type
val constrβ constructor time!! π§ optional?loc:Ast_helper.loc, optional?attrs:Ast_helper.attrs, then anAst_helper.lidand aParsetree.core_type list, and boom you get aParsetree.class_type. note thelistβ it's plural, it takes many core types, not one:
val constr : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Ast_helper.lid -> Parsetree.core_type list -> Parsetree.class_type
val signatureβ wraps a signature into a class type π¦ optional?loc:Ast_helper.loc, optional?attrs:Ast_helper.attrs, aParsetree.class_signature, and out comes aParsetree.class_type:
val signature : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Parsetree.class_signature -> Parsetree.class_type
val arrowβ the arrow one, very type-theory girlboss of it π₯ optional?loc:Ast_helper.loc, optional?attrs:Ast_helper.attrs, then anAsttypes.arg_label, aParsetree.core_type, and aParsetree.class_typeβ which gives you back anotherParsetree.class_type. look at all those arrows, it's arrows on arrows:
val arrow : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Asttypes.arg_label -> Parsetree.core_type -> Parsetree.class_type ->
Parsetree.class_type
val extensionβ extension node energy β optional?loc:Ast_helper.loc, optional?attrs:Ast_helper.attrs, aParsetree.extension, and you get aParsetree.class_type:
val extension : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Parsetree.extension -> Parsetree.class_type
val open_β yes it has the trailing underscore, that's not a typo, that's just OCaml being OCaml π optional?loc:Ast_helper.loc, optional?attrs:Ast_helper.attrs, aParsetree.open_description, and aParsetree.class_typewhich becomes aParsetree.class_type:
val open_ : ?loc:Ast_helper.loc -> ?attrs:Ast_helper.attrs ->
Parsetree.open_description -> Parsetree.class_type ->
Parsetree.class_type
heads up bestie: those?loc:Ast_helper.locand?attrs:Ast_helper.attrsargs are optional inmk,constr,signature,arrow,extensionandopen_β butattrhas no optional args at all, it's just the two positional ones. don't come for me, that's literally what the page says π
and that's the whole page, fr fr β every single value accounted for, nothing skipped, nothing invented π
cute little sign-off time: this page is brought to you by OCamldoc, version dated 2026-06-22, and the page itself is Ast_helper.Cty(3) π«Ά go forth and construct your class types, you're gonna eat π
β¨
π¦ 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