]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/lambda-delta/common/hierarchy.ml
- performance data added for reference
[helm.git] / helm / software / lambda-delta / common / hierarchy.ml
index f916e1e4316671761f0218d76f11b84ee40bd30f..abe23e10a04e4a195bd1e6592e2747deac003818 100644 (file)
@@ -30,20 +30,16 @@ let set_new_sorts f ss =
    let f i = index := i; f i in   
    C.list_fold_left f set_sort !index ss 
 
-let get_sort f h =
-   try f (Some (H.find sort h))
-   with Not_found -> f None
+let get_sort err f h =
+   try f (H.find sort h) with Not_found -> err ()
 
 let string_of_graph f (s, _) = f s
 
 let apply f (_, g) h = f (g h)
 
-let graph_of_string f s =
+let graph_of_string err f s =
    try 
       let x = S.sscanf s "Z%u" C.start in 
-      if x > 0 then f (Some (s, fun h -> x + h)) else f None
+      if x > 0 then f (s, fun h -> x + h) else err ()
    with
-      S.Scan_failure _ | Failure _ | End_of_file -> f None
-
-let graph =
-   ref (graph_of_string (function Some g -> g | None -> assert false) "Z2")
+      S.Scan_failure _ | Failure _ | End_of_file -> err ()