| 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 Environ |
| 13 | open Entries |
| 14 | open Constrexpr |
| 15 | open Libnames |
| 16 | |
| 17 | (** Module internalization errors *) |
| 18 | |
| 19 | type module_internalization_error = |
| 20 | | NotAModuleNorModtype of qualid |
| 21 | | NotAModuleType of qualid |
| 22 | | NotAModule of qualid |
| 23 | | IncorrectWithInModule |
| 24 | | IncorrectModuleApplication |
| 25 | |
| 26 | exception ModuleInternalizationError of module_internalization_error |
| 27 | |
| 28 | (** Module expressions and module types are interpreted relatively to |
| 29 | possible functor or functor signature arguments. When the input kind |
| 30 | is ModAny (i.e. module or module type), we tries to interprete this ast |
| 31 | as a module, and in case of failure, as a module type. The returned |
| 32 | kind is never ModAny, and it is equal to the input kind when this one |
| 33 | isn't ModAny. *) |
| 34 | |
| 35 | type module_kind = Module | ModType | ModAny |
| 36 | |
| 37 | type module_struct_expr = (universe_decl_expr option * constr_expr) Declarations.module_alg_expr |
| 38 | |
| 39 | (** Module internalization, i.e. from AST to module expression *) |
| 40 | val intern_module_ast : |
| 41 | module_kind -> module_ast -> module_struct_expr * ModPath.t * module_kind |
| 42 | |
| 43 | (** Module interpretation, i.e. from module expression to typed module entry *) |
| 44 | val interp_module_ast : |
| 45 | env -> module_kind -> ModPath.t -> module_struct_expr -> module_struct_entry * Univ.ContextSet.t |