summaryrefslogtreecommitdiff
path: root/contrib/extraction/modutil.mli
blob: 85d58a4b2f1bb0101a6498918e71b008d155575a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
(************************************************************************)
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
(*   \VV/  **************************************************************)
(*    //   *      This file is distributed under the terms of the       *)
(*         *       GNU Lesser General Public License Version 2.1        *)
(************************************************************************)

(*i $Id: modutil.mli 10620 2008-03-05 10:54:41Z letouzey $ i*)

open Names
open Declarations
open Environ
open Libnames
open Miniml
open Mod_subst

(*s Functions upon modules missing in [Modops]. *) 

(* Change a msid in a module type, to follow a module expr. *)

val replicate_msid : struct_expr_body -> struct_expr_body -> struct_expr_body

(*s Functions upon ML modules. *)

val struct_ast_search : (ml_ast -> bool) -> ml_structure -> bool
val struct_type_search : (ml_type -> bool) -> ml_structure -> bool

type do_ref = global_reference -> unit 

val decl_iter_references : do_ref -> do_ref -> do_ref -> ml_decl -> unit
val spec_iter_references : do_ref -> do_ref -> do_ref -> ml_spec -> unit
val struct_iter_references : do_ref -> do_ref -> do_ref -> ml_structure -> unit

type 'a kinds = { mutable typ : 'a ; mutable trm : 'a; mutable cons : 'a }

val struct_get_references_set : ml_structure -> Refset.t kinds
val struct_get_references_list : ml_structure -> global_reference list kinds

val signature_of_structure : ml_structure -> ml_signature

val get_decl_in_structure : global_reference -> ml_structure -> ml_decl

(* Some transformations of ML terms. [optimize_struct] simplify
   all beta redexes (when the argument does not occur, it is just
   thrown away; when it occurs exactly once it is substituted; otherwise
   a let-in redex is created for clarity) and iota redexes, plus some other
   optimizations. The first argument is the list of objects we want to appear.
*)

val optimize_struct : global_reference list -> ml_structure -> ml_structure