Debian Codegraph @

pretyping/geninterp.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 (** Interpretation functions for generic arguments and interpreted Ltac
12 values. *)
13
14 open Names
15 open Genarg
16
17 (** {6 Dynamic toplevel values} *)
18
19 module Val :
20 sig
21 type 'a typ
22
23 val create : string -> 'a typ
24
25 type _ tag =
26 | Base : 'a typ -> 'a tag
27 | List : 'a tag -> 'a list tag
28 | Opt : 'a tag -> 'a option tag
29 | Pair : 'a tag * 'b tag -> ('a * 'b) tag
30
31 type t = Dyn : 'a typ * 'a -> t
32
33 val eq : 'a typ -> 'b typ -> ('a, 'b) CSig.eq option
34 val repr : 'a typ -> string
35 val pr : 'a typ -> Pp.t
36
37 val typ_list : t list typ
38 val typ_opt : t option typ
39 val typ_pair : (t * t) typ
40
41 val inject : 'a tag -> 'a -> t
42
43 end
44
45 module ValTMap (Value : Dyn.ValueS) :
46 Dyn.MapS with type 'a key = 'a Val.typ and type 'a value = 'a Value.t
47
48 (** Dynamic types for toplevel values. While the generic types permit to relate
49 objects at various levels of interpretation, toplevel values are wearing
50 their own type regardless of where they came from. This allows to use the
51 same runtime representation for several generic types. *)
52
53 val val_tag : 'a typed_abstract_argument_type -> 'a Val.tag
54 (** Retrieve the dynamic type associated to a toplevel genarg. *)
55
56 val register_val0 : ('raw, 'glb, 'top) genarg_type -> 'top Val.tag option -> unit
57 (** Register the representation of a generic argument. If no tag is given as
58 argument, a new fresh tag with the same name as the argument is associated
59 to the generic type. *)
60
61 (** {6 Interpretation functions} *)
62
63 module TacStore : Store.S
64
65 type interp_sign =
66 { lfun : Val.t Id.Map.t
67 ; poly : PolyFlags.t
68 ; extra : TacStore.t }
69
70 type ('glb, 'top) interp_fun = interp_sign -> 'glb -> 'top Ftactic.t
71
72 val interp : ('raw, 'glb, 'top) genarg_type -> ('glb, Val.t) interp_fun
73
74 val generic_interp : (glob_generic_argument, Val.t) interp_fun
75
76 val register_interp0 :
77 ('raw, 'glb, 'top) genarg_type -> ('glb, Val.t) interp_fun -> unit