for functions with only variable patterns, fixrec definitions no longer use Fixrec.return/Fixrec.run
authorhuffman
Sat, 22 May 2010 18:34:38 -0700
changeset 37097 476016cbf8b3
parent 37096 7b74b4a734fd
child 37098 b86d546c5282
for functions with only variable patterns, fixrec definitions no longer use Fixrec.return/Fixrec.run
src/HOLCF/Tools/fixrec.ML
--- a/src/HOLCF/Tools/fixrec.ML	Sat May 22 17:57:16 2010 -0700
+++ b/src/HOLCF/Tools/fixrec.ML	Sat May 22 18:34:38 2010 -0700
@@ -78,9 +78,16 @@
   in Const(@{const_name Fixrec.mplus}, mT ->> mT ->> mT) ` t ` u end;
 
 fun mk_run t =
-  let val mT = Term.fastype_of t
-      val T = dest_matchT mT
-  in Const(@{const_name Fixrec.run}, mT ->> T) ` t end;
+  let
+    val mT = Term.fastype_of t
+    val T = dest_matchT mT
+    val run = Const(@{const_name Fixrec.run}, mT ->> T)
+  in
+    case t of
+      Const(@{const_name Rep_CFun}, _) $
+        Const(@{const_name Fixrec.return}, _) $ u => u
+    | _ => run ` t
+  end;
 
 
 (*************************************************************************)
@@ -129,7 +136,7 @@
         val prop = mk_trp (mk_cont functional);
         fun err _ = error (
           "Continuity proof failed; please check that cont2cont rules\n" ^
-          "are configured for all non-HOLCF constants.\n" ^
+          "or simp rules are configured for all non-HOLCF constants.\n" ^
           "The error occurred for the goal statement:\n" ^
           Syntax.string_of_term lthy prop);
         val rules = Cont2ContData.get lthy;