Module Genarg
Generic arguments used by the extension mechanisms of several Coq ASTs.
Generic types
module ArgT : sig ... endtype (_, _, _) genarg_type=|ExtraArg : ('a, 'b, 'c) ArgT.tag -> ('a, 'b, 'c) genarg_type|ListArg : ('a, 'b, 'c) genarg_type -> ('a list, 'b list, 'c list) genarg_type|OptArg : ('a, 'b, 'c) genarg_type -> ('a option, 'b option, 'c option) genarg_type|PairArg : ('a1, 'b1, 'c1) genarg_type * ('a2, 'b2, 'c2) genarg_type -> ('a1 * 'a2, 'b1 * 'b2, 'c1 * 'c2) genarg_typeGeneric types. The first parameter is the OCaml lowest level, the second one is the globalized level, and third one the internalized level.
type 'a uniform_genarg_type= ('a, 'a, 'a) genarg_typeAlias for concision when the three types agree.
val make0 : string -> ('raw, 'glob, 'top) genarg_typeCreate a new generic type of argument: force to associate unique ML types at each of the three levels.
val create_arg : string -> ('raw, 'glob, 'top) genarg_typeAlias for
make0.
Specialized types
type rlevel=[|`rlevel]type glevel=[|`glevel]type tlevel=[|`tlevel]type (_, _) abstract_argument_type=|Rawwit : ('a, 'b, 'c) genarg_type -> ('a, rlevel) abstract_argument_type|Glbwit : ('a, 'b, 'c) genarg_type -> ('b, glevel) abstract_argument_type|Topwit : ('a, 'b, 'c) genarg_type -> ('c, tlevel) abstract_argument_typeGeneric types at a fixed level. The first parameter embeds the OCaml type and the second one the level.
type 'a raw_abstract_argument_type= ('a, rlevel) abstract_argument_typeSpecialized type at raw level.
type 'a glob_abstract_argument_type= ('a, glevel) abstract_argument_typeSpecialized type at globalized level.
type 'a typed_abstract_argument_type= ('a, tlevel) abstract_argument_typeSpecialized type at internalized level.
Projections
val rawwit : ('a, 'b, 'c) genarg_type -> ('a, rlevel) abstract_argument_typeProjection on the raw type constructor.
val glbwit : ('a, 'b, 'c) genarg_type -> ('b, glevel) abstract_argument_typeProjection on the globalized type constructor.
val topwit : ('a, 'b, 'c) genarg_type -> ('c, tlevel) abstract_argument_typeProjection on the internalized type constructor.
Generic arguments
type 'l generic_argument=|GenArg : ('a, 'l) abstract_argument_type * 'a -> 'l generic_argumentA inhabitant of
'level generic_argumentis a inhabitant of some type at level'level, together with the representation of this type.type raw_generic_argument= rlevel generic_argumenttype glob_generic_argument= glevel generic_argumenttype typed_generic_argument= tlevel generic_argument
Constructors
val in_gen : ('a, 'co) abstract_argument_type -> 'a -> 'co generic_argumentin_gen t xembeds an argument of typetinto a generic argument.
val out_gen : ('a, 'co) abstract_argument_type -> 'co generic_argument -> 'aout_gen t xrecovers an argument of typetfrom a generic argument. It fails ifxhas not the right dynamic type.
val has_type : 'co generic_argument -> ('a, 'co) abstract_argument_type -> boolhas_type v ttells whethervhas typet. If true, it ensures thatout_gen t vwill not raise a dynamic type exception.
Type reification
type argument_type=|ArgumentType : ('a, 'b, 'c) genarg_type -> argument_type
Equalities
val argument_type_eq : argument_type -> argument_type -> boolval genarg_type_eq : ('a1, 'b1, 'c1) genarg_type -> ('a2, 'b2, 'c2) genarg_type -> ('a1 * 'b1 * 'c1, 'a2 * 'b2 * 'c2) CSig.eq optionval abstract_argument_type_eq : ('a, 'l) abstract_argument_type -> ('b, 'l) abstract_argument_type -> ('a, 'b) CSig.eq optionval pr_argument_type : argument_type -> Pp.tPrint a human-readable representation for a given type.
val genarg_tag : 'a generic_argument -> argument_typeval unquote : ('a, 'co) abstract_argument_type -> argument_type
Registering genarg-manipulating functions
This is boilerplate code used here and there in the code of Coq.
val get_arg_tag : ('a, 'b, 'c) genarg_type -> ('a, 'b, 'c) ArgT.tagWorks only on base objects (ExtraArg), otherwise fails badly.
module type GenObj = sig ... endCompatibility layer
The functions below are aliases for generic_type constructors.
val wit_list : ('a, 'b, 'c) genarg_type -> ('a list, 'b list, 'c list) genarg_typeval wit_opt : ('a, 'b, 'c) genarg_type -> ('a option, 'b option, 'c option) genarg_typeval wit_pair : ('a1, 'b1, 'c1) genarg_type -> ('a2, 'b2, 'c2) genarg_type -> ('a1 * 'a2, 'b1 * 'b2, 'c1 * 'c2) genarg_type