aboutsummaryrefslogtreecommitdiff
path: root/pretyping
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2020-09-30 13:21:02 +0200
committerPierre-Marie Pédrot2020-09-30 13:41:38 +0200
commitf16290030b48dedf3091334af4cd21a7df157381 (patch)
treed8719b40c6ab8e009816f1a6f4f74aa67c72eec3 /pretyping
parente3a1cf35313bbc4eaca2a43f5fc95ca306bc45fa (diff)
Further simplification of the typeclass registration API.
Diffstat (limited to 'pretyping')
-rw-r--r--pretyping/typeclasses.ml9
-rw-r--r--pretyping/typeclasses.mli10
2 files changed, 13 insertions, 6 deletions
diff --git a/pretyping/typeclasses.ml b/pretyping/typeclasses.ml
index 78f04c99e5..fc71254a46 100644
--- a/pretyping/typeclasses.ml
+++ b/pretyping/typeclasses.ml
@@ -41,7 +41,11 @@ let get_solve_one_instance, solve_one_instance_hook = Hook.make ()
let resolve_one_typeclass ?(unique=get_typeclasses_unique_solutions ()) env evm t =
Hook.get get_solve_one_instance env evm t unique
-type direction = Backward
+type class_method = {
+ meth_name : Name.t;
+ meth_info : hint_info option;
+ meth_const : Constant.t option;
+}
(* This module defines type-classes *)
type typeclass = {
@@ -58,8 +62,7 @@ type typeclass = {
cl_props : Constr.rel_context;
(* The method implementations as projections. *)
- cl_projs : (Name.t * (direction * hint_info) option
- * Constant.t option) list;
+ cl_projs : class_method list;
cl_strict : bool;
diff --git a/pretyping/typeclasses.mli b/pretyping/typeclasses.mli
index c0e71f26c4..3f84d08a7e 100644
--- a/pretyping/typeclasses.mli
+++ b/pretyping/typeclasses.mli
@@ -13,8 +13,6 @@ open Constr
open Evd
open Environ
-type direction = Backward
-
(* Core typeclasses hints *)
type 'a hint_info_gen =
{ hint_priority : int option;
@@ -22,6 +20,12 @@ type 'a hint_info_gen =
type hint_info = (Pattern.patvar list * Pattern.constr_pattern) hint_info_gen
+type class_method = {
+ meth_name : Name.t;
+ meth_info : hint_info option;
+ meth_const : Constant.t option;
+}
+
(** This module defines type-classes *)
type typeclass = {
cl_univs : Univ.AUContext.t;
@@ -39,7 +43,7 @@ type typeclass = {
cl_props : Constr.rel_context;
(** Context of definitions and properties on defs, will not be shared *)
- cl_projs : (Name.t * (direction * hint_info) option * Constant.t option) list;
+ cl_projs : class_method list;
(** The methods implementations of the typeclass as projections.
Some may be undefinable due to sorting restrictions or simply undefined if
no name is provided. The [int option option] indicates subclasses whose hint has