]> matita.cs.unibo.it Git - helm.git/blobdiff - components/library/coercGraph.ml
added support for "polymorphic" coercions
[helm.git] / components / library / coercGraph.ml
index cd958a8f62074aa5ba4ac76fb023043b2478587e..62a89b0a71ea36ed8b5ad3b48912a1c7af8616a9 100644 (file)
@@ -94,4 +94,21 @@ let target_of t =
     CoercDb.term_of_carr (snd (CoercDb.get_carr uri))
   with Invalid_argument _ -> assert false (* t must be a coercion *)
     
+let generate_dot_file () =
+  let l = CoercDb.to_list () in
+  let preamble = "
+    digraph pippo {
+      node [fontsize=9, width=.4, height=.4];
+      edge [fontsize=10]; 
+      \n" 
+  in
+  let conclusion = " } \n" in
+  let data = List.fold_left 
+    (fun acc (src,tgt,c) -> 
+      acc ^ CoercDb.name_of_carr src ^ " -> " ^ 
+      CoercDb.name_of_carr tgt ^ "[label=\"" ^ UriManager.name_of_uri c ^ 
+      "\"];\n") "" l 
+  in
+  preamble ^ data ^ conclusion
+  
 (* EOF *)