6 (* mapping from type parameters to functor arguments *)
7 argmap
: Type.name
Type.NameMap.t
;
8 (* ordered list of type parameters *)
9 params
: Type.param list
;
11 tnames
: Type.NameSet.t
;
12 (* For class dependencies, e.g. Pickle. *)
13 toplevel
: (Type.name
* Type.expr
) option
17 val _loc
: Loc.t
(* location of the type definition being derived *)
22 d_generate_expr
: context
-> Type.expr
-> Ast.module_expr
;
25 module type ClassDescription
= sig
28 val default_module
: name
option
29 val allow_private
: bool
30 val predefs
: (Type.qname
* Type.name
) list
31 val depends
: (Loc.t
-> dependency
) list
34 module type Class
= sig
35 val generate
: Type.decl list
-> Ast.str_item
36 val generate_sigs
: Type.decl list
-> Ast.sig_item
37 val generate_expr
: context
-> Type.expr
-> Ast.module_expr
40 class type virtual generator
= object
42 method rhs
: context
-> Type.decl
-> Ast.module_expr
43 method expr
: context
-> Type.expr
-> Ast.module_expr
45 method mapply
: context
-> Ast.module_expr
-> Type.expr list
-> Ast.module_expr
47 method constr
: context
-> Type.qname
* Type.expr list
-> Ast.module_expr
48 method param
: context
-> Type.param
-> Ast.module_expr
50 method wrap
: context
-> Type.expr
-> Ast.str_item list
-> Ast.module_expr
52 method call_expr
: context
-> Type.expr
-> string -> Ast.expr
55 ?eq
:Type.expr
-> context
->
56 Type.name
-> Type.param list
-> Type.constraint_ list
->
57 Type.summand list
-> Ast.str_item list
58 method virtual tuple
: context
-> Type.expr list
-> Ast.str_item list
59 method virtual variant
:
61 Type.name
-> Type.param list
-> Type.constraint_ list
->
62 Type.variant
-> Ast.str_item list
63 method virtual record
:
64 ?eq
:Type.expr
-> context
->
65 Type.name
-> Type.param list
-> Type.constraint_ list
->
66 Type.field list
-> Ast.str_item list
68 method class_
: context
-> [ `NYI
] -> Ast.str_item list
69 method function_
: context
-> Type.expr
* Type.expr
-> Ast.str_item list
72 [ `NonOptional
| `Optional
] * Type.name
* Type.expr
* Type.expr
->
74 method object_
: context
-> [ `NYI
] -> Ast.str_item list
78 module type ClassHelpers
= sig
81 module Untranslate
: Type.Untranslate
83 val seq
: Ast.expr
-> Ast.expr
-> Ast.expr
84 val seq_list
: Ast.expr list
-> Ast.expr
86 val record_pattern
: ?prefix
:string -> Type.field list
-> Ast.patt
87 val record_expr
: (string * Ast.expr
) list
-> Ast.expr
88 val record_expression
: ?prefix
:string -> Type.field list
-> Ast.expr
90 val expr_list
: Ast.expr list
-> Ast.expr
91 val patt_list
: Ast.patt list
-> Ast.patt
93 val tuple_expr
: Ast.expr list
-> Ast.expr
94 val tuple
: ?param
:string -> int -> string list
* Ast.patt
* Ast.expr
97 Type.name
Type.NameMap.t
-> ?param
:string ->
98 Type.expr
-> Ast.patt
* Ast.expr
* Ast.expr
100 (* For Functor only *)
101 val modname_from_qname
: qname
:string list
-> classname
:string -> Ast.ident
102 val substitute
: Type.name
Type.NameMap.t
-> Type.expr
-> Type.expr
103 val setup_context
: Type.decl list
-> context
105 (* For Pickle only *)
106 val instantiate_modargs_repr
: Type.name
Type.NameMap.t
-> Type.repr
-> Type.repr
108 class virtual make_module_expr
: generator
109 val make_module_sig
: context
-> Type.decl
-> Ast.module_type
110 val make_module_type
: context
-> Type.decl
-> Ast.module_type
112 val default_generate
:
113 make_module_expr
:(context
-> Type.decl
-> Ast.module_expr
) ->
114 make_module_type
:(context
-> Type.decl
-> Ast.module_type
) ->
115 Type.decl list
-> Ast.str_item
116 val default_generate_sigs
:
117 make_module_sig
:(context
-> Type.decl
-> Ast.module_type
) ->
118 Type.decl list
-> Ast.sig_item