Debian Codegraph @

vernac/declaremods.mli

raw symbols SCIP
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 open Names
12 open Modintern
13
14 (** {6 Modules } *)
15
16 (** Rigid / flexible module signature *)
17
18 type 'a module_signature =
19 | Enforce of 'a (** ... : T *)
20 | Check of 'a list (** ... <: T1 <: T2, possibly empty *)
21
22 (** Which module inline annotations should we honor,
23 either None or the ones whose level is less or equal
24 to the given integer *)
25
26 type inline =
27 | NoInline
28 | DefaultInline
29 | InlineAt of int
30
31 val default_inline_level : unit -> int option
32
33 (** Kinds of modules *)
34
35 type module_params = (lident list * (Constrexpr.module_ast * inline)) list
36 type module_expr = (module_struct_expr * ModPath.t * module_kind * Entries.inline)
37 type module_params_expr = (MBId.t list * module_expr) list
38
39 (** {6 Libraries i.e. modules on disk } *)
40
41 type library_name = DirPath.t
42
43 type library_objects
44
45 module Synterp : sig
46
47 val declare_module :
48 Id.t ->
49 module_params ->
50 (Constrexpr.module_ast * inline) module_signature ->
51 (Constrexpr.module_ast * inline) list ->
52 ModPath.t * module_params_expr * module_expr list * module_expr module_signature
53
54 val start_module :
55 Lib.export -> Id.t ->
56 module_params ->
57 (Constrexpr.module_ast * inline) module_signature ->
58 ModPath.t * module_params_expr * module_expr module_signature
59
60 val end_module : unit -> ModPath.t
61
62 val declare_include :
63 (Constrexpr.module_ast * inline) list ->
64 module_expr list
65
66 val declare_modtype :
67 Id.t ->
68 module_params ->
69 (Constrexpr.module_ast * inline) list ->
70 (Constrexpr.module_ast * inline) list ->
71 ModPath.t * module_params_expr * module_expr list * module_expr list
72
73 val start_modtype :
74 Id.t ->
75 module_params ->
76 (Constrexpr.module_ast * inline) list ->
77 ModPath.t * module_params_expr * module_expr list
78
79 val end_modtype : unit -> ModPath.t
80
81 val import_module : Libobject.open_filter -> export:Lib.export_flag -> ModPath.t -> unit
82
83 val import_modules : export:Lib.export_flag -> (Libobject.open_filter * ModPath.t) list -> unit
84
85 val register_library : library_name -> library_objects -> unit
86
87 val close_section : unit -> unit
88
89 end
90
91 module Interp : sig
92
93 (** [declare_module id fargs typ exprs] declares module [id], from
94 functor arguments [fargs], with final type [typ]. [exprs] is
95 usually of length 1 (Module definition with a concrete body), but
96 it could also be empty ("Declare Module", with non-empty [typ]), or
97 multiple (body of the shape M <+ N <+ ...). *)
98
99 val declare_module :
100 Id.t ->
101 module_params_expr ->
102 module_expr module_signature ->
103 module_expr list ->
104 ModPath.t
105
106 val start_module :
107 Lib.export -> Id.t ->
108 module_params_expr ->
109 module_expr module_signature ->
110 ModPath.t
111
112 val end_module : unit -> ModPath.t
113
114 (** {6 Module types } *)
115
116 (** [declare_modtype interp_modast id fargs typs exprs]
117 Similar to [declare_module], except that the types could be multiple *)
118
119 val declare_modtype :
120 Id.t ->
121 module_params_expr ->
122 module_expr list ->
123 module_expr list ->
124 ModPath.t
125
126 val start_modtype :
127 Id.t ->
128 module_params_expr ->
129 module_expr list ->
130 ModPath.t
131
132 val end_modtype : unit -> ModPath.t
133
134 val register_library :
135 library_name ->
136 Safe_typing.compiled_library -> library_objects -> Safe_typing.vodigest ->
137 Vmlibrary.on_disk ->
138 unit
139
140 (** [import_module export mp] imports the module [mp].
141 It modifies Nametab and performs the [open_object] function for
142 every object of the module. Raises [Not_found] when [mp] is unknown
143 or when [mp] corresponds to a functor. If [export] is [true], the module is also
144 opened every time the module containing it is. *)
145
146 val import_module : Libobject.open_filter -> export:Lib.export_flag -> ModPath.t -> unit
147
148 (** Same as [import_module] but for multiple modules, and more optimized than
149 iterating [import_module]. *)
150 val import_modules : export:Lib.export_flag -> (Libobject.open_filter * ModPath.t) list -> unit
151
152 (** Include *)
153
154 val declare_include : module_expr list -> unit
155
156 val close_section : unit -> unit
157
158 end
159
160 val start_library : library_name -> unit
161
162 val end_library :
163 output_native_objects:bool -> library_name ->
164 Safe_typing.compiled_library * library_objects * library_objects * Vmlibrary.compiled_library * Nativelib.native_library * Library_info.t
165
166 (** append a function to be executed at end_library *)
167 val append_end_library_hook : (unit -> unit) -> unit
168
169
170 (** {6 ... } *)
171 (** [iter_all_interp_segments] iterate over all segments, the modules'
172 segments first and then the current segment. Modules are presented
173 in an arbitrary order. The given function is applied to all leaves
174 (together with their section path). Ignores synterp objects. *)
175
176 val iter_all_interp_segments :
177 (Libobject.object_prefix -> Libobject.t -> unit) -> unit
178
179
180 val debug_print_modtab : unit -> Pp.t
181
182 (** For printing modules, [process_module_binding] adds names of
183 bound module (and its components) to Nametab. It also loads
184 objects associated to it. It may raise a [Failure] when the
185 bound module hasn't an atomic type. *)
186
187 val process_module_binding :
188 MBId.t -> (Constr.t * UVars.AbstractContext.t option) Declarations.module_alg_expr -> unit