merged
authorpaulson
Thu, 19 Dec 2024 17:01:54 +0000
changeset 81637 445d27ab591b
parent 81635 362b2ff84206 (diff)
parent 81636 55a02b8cdcf9 (current diff)
child 81638 fe7238c01809
merged
--- a/src/HOL/Tools/Sledgehammer/sledgehammer.ML	Thu Dec 19 17:01:40 2024 +0000
+++ b/src/HOL/Tools/Sledgehammer/sledgehammer.ML	Thu Dec 19 17:01:54 2024 +0000
@@ -494,23 +494,20 @@
     val hash = SHA1.rep (SHA1.digest arg)
     val file = cache_dir + Path.explode hash
   in
-    if File.is_file file then
+    (case try File.read file of
+      NONE => 
+      let val result = f arg in
+        File.write file result;
+        result
+      end
+    | SOME s =>
       let
         val () =
           if verbose then
             writeln ("Found problem with key " ^ hash ^ " in cache.")
           else
             ()
-      in
-        File.read file
-      end
-    else
-      let
-        val result = f arg
-      in
-        File.write file result;
-        result
-      end
+      in s end)
   end
 in