]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/ng_refiner/nCicUnifHint.ml
Initial implementation of statuses using objects in place of nested records.
[helm.git] / helm / software / components / ng_refiner / nCicUnifHint.ml
index c09e08d3c6b506c4f144d929ce8c273975bb79a5..ccccfca88742dfd48b1ef1a892229f70cd502e12 100644 (file)
@@ -24,6 +24,13 @@ module DB =
 
 type db = DB.t
 
+class status =
+ object
+  val db = DB.empty
+  method uhint_db = db
+  method set_uhint_db v = {< db = v >}
+ end
+
 let dummy = NCic.Const (NReference.reference_of_string "cic:/dummy_conv.dec");;
 let pair t1 t2 = (NCic.Appl [dummy;t1;t2]) ;;
 
@@ -57,11 +64,9 @@ let index_hint hdb context t1 t2 precedence =
     NCicPp.ppterm ~metasenv:[] ~subst:[] ~context:[] src ^ " |==> " ^
     NCicPp.ppterm ~metasenv:[] ~subst:[] ~context:[] data);
 *)
-  DB.index hdb src (precedence, data)
+  hdb#set_uhint_db (DB.index hdb#uhint_db src (precedence, data))
 ;;
 
-let empty_db = DB.empty ;;
-
 let add_user_provided_hint db t precedence =
   let c, a, b = 
     let rec aux ctx = function
@@ -176,8 +181,8 @@ let look_for_hint hdb metasenv subst context t1 t2 =
       String.concat "|" (List.map (NCicPp.ppterm ~metasenv:[] ~subst:[]
       ~context:[]) (HintSet.elements ds))));
 *)
-  let candidates1 = DB.retrieve_unifiables hdb (pair t1 t2) in
-  let candidates2 = DB.retrieve_unifiables hdb (pair t2 t1) in
+  let candidates1 = DB.retrieve_unifiables hdb#uhint_db (pair t1 t2) in
+  let candidates2 = DB.retrieve_unifiables hdb#uhint_db (pair t2 t1) in
   let candidates1 = 
     List.map (fun (prec,ty) -> 
        prec,true,saturate ~delta:max_int metasenv subst context ty 0)