recovered printing of record updates over compound terms, e.g. "(|x = a|)(|x := b|)", which was apparently broken in 45a2ffc5911e;
authorwenzelm
Sat, 15 Jan 2011 17:32:07 +0100
changeset 41578 f5e7f6712815
parent 41577 9a64c4007864
child 41579 4031fb078acc
recovered printing of record updates over compound terms, e.g. "(|x = a|)(|x := b|)", which was apparently broken in 45a2ffc5911e; tuned;
src/HOL/Tools/record.ML
--- a/src/HOL/Tools/record.ML	Sat Jan 15 16:49:10 2011 +0100
+++ b/src/HOL/Tools/record.ML	Sat Jan 15 17:32:07 2011 +0100
@@ -953,26 +953,30 @@
 
 local
 
+fun dest_update ctxt c =
+  (case try Syntax.unmark_const c of
+    SOME d => try (unsuffix updateN) (Consts.extern (ProofContext.consts_of ctxt) d)
+  | NONE => NONE);
+
 fun field_updates_tr' ctxt (tm as Const (c, _) $ k $ u) =
-      let
-        val extern = Consts.extern (ProofContext.consts_of ctxt);
-        val t =
-          (case k of
-            Abs (_, _, Abs (_, _, t) $ Bound 0) =>
-              if null (loose_bnos t) then t else raise Match
-          | Abs (_, _, t) =>
-              if null (loose_bnos t) then t else raise Match
-          | _ => raise Match);
-      in
-        (case Option.map extern (try Syntax.unmark_const c) of
-          SOME update_name =>
-            (case try (unsuffix updateN) update_name of
-              SOME name =>
+      (case dest_update ctxt c of
+        SOME name =>
+          let
+            val opt_t =
+              (case k of
+                Abs (_, _, Abs (_, _, t) $ Bound 0) =>
+                  if null (loose_bnos t) then SOME t else NONE
+              | Abs (_, _, t) =>
+                  if null (loose_bnos t) then SOME t else NONE
+              | _ => NONE);
+          in
+            (case opt_t of
+              SOME t =>
                 apfst (cons (Syntax.const @{syntax_const "_field_update"} $ Syntax.free name $ t))
                   (field_updates_tr' ctxt u)
             | NONE => ([], tm))
-        | NONE => ([], tm))
-      end
+          end
+      | NONE => ([], tm))
   | field_updates_tr' _ tm = ([], tm);
 
 fun record_update_tr' ctxt tm =