1
(************************************************************************)
2
(* v * The Coq Proof Assistant / The Coq Development Team *)
3
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
4
(* \VV/ **************************************************************)
5
(* // * This file is distributed under the terms of the *)
6
(* * GNU Lesser General Public License Version 2.1 *)
7
(************************************************************************)
9
(*i $Id: typeclasses.mli 11576 2008-11-10 19:13:15Z msozeau $ i*)
25
(* This module defines type-classes *)
27
(* The class implementation: a record parameterized by the context with defs in it or a definition if
28
the class is a singleton. This acts as the class' global identifier. *)
29
cl_impl : global_reference;
31
(* Context in which the definitions are typed. Includes both typeclass parameters and superclasses.
32
The boolean indicates if the typeclass argument is a direct superclass and the global reference
33
gives a direct link to the class itself. *)
34
cl_context : (global_reference * bool) option list * rel_context;
36
(* Context of definitions and properties on defs, will not be shared *)
37
cl_props : rel_context;
39
(* The methods implementations of the typeclass as projections. Some may be undefinable due to
40
sorting restrictions. *)
41
cl_projs : (identifier * constant option) list;
46
val instances : global_reference -> instance list
47
val typeclasses : unit -> typeclass list
48
val all_instances : unit -> instance list
50
val add_class : typeclass -> unit
52
val new_instance : typeclass -> int option -> bool -> constant -> instance
53
val add_instance : instance -> unit
55
val class_info : global_reference -> typeclass (* raises a UserError if not a class *)
58
(* These raise a UserError if not a class. *)
59
val dest_class_app : env -> constr -> typeclass * constr list
61
(* Just return None if not a class *)
62
val class_of_constr : constr -> typeclass option
64
val instance_impl : instance -> constant
66
val is_class : global_reference -> bool
67
val is_instance : global_reference -> bool
68
val is_method : constant -> bool
70
val is_implicit_arg : hole_kind -> bool
72
(* Returns the term and type for the given instance of the parameters and fields
75
val instance_constructor : typeclass -> constr list -> constr * types
77
(* Use evar_extra for marking resolvable evars. *)
78
val bool_in : bool -> Dyn.t
79
val bool_out : Dyn.t -> bool
81
val is_resolvable : evar_info -> bool
82
val mark_unresolvable : evar_info -> evar_info
83
val mark_unresolvables : evar_map -> evar_map
84
val is_class_evar : evar_info -> bool
86
val resolve_typeclasses : ?onlyargs:bool -> ?split:bool -> ?fail:bool ->
87
env -> evar_defs -> evar_defs
88
val resolve_one_typeclass : env -> evar_map -> types -> constr
90
val register_add_instance_hint : (constant -> int option -> unit) -> unit
91
val add_instance_hint : constant -> int option -> unit
93
val solve_instanciations_problem : (env -> evar_defs -> bool -> bool -> bool -> evar_defs) ref
94
val solve_instanciation_problem : (env -> evar_map -> types -> constr) ref