improved code generation for wfrec
authorhaftmann
Tue, 09 May 2006 10:10:57 +0200
changeset 19602 e25d1e9a0675
parent 19601 299d4cd2ef51
child 19603 9801b391c8b3
improved code generation for wfrec
src/HOL/Wellfounded_Recursion.thy
--- a/src/HOL/Wellfounded_Recursion.thy	Tue May 09 10:10:28 2006 +0200
+++ b/src/HOL/Wellfounded_Recursion.thy	Tue May 09 10:10:57 2006 +0200
@@ -288,18 +288,14 @@
 fun wfrec f x = f (wfrec f) x;
 *}
 
-code_primconst wfrec
-ml {*
-fun `_` f x = f (`_` f) x;
-*}
-haskell {*
-`_` f x = f (`_` f) x
+setup {*
+  CodegenPackage.add_appconst ("wfrec", ((3, 3), CodegenPackage.appgen_wfrec))
 *}
 
-(* code_syntax_const
+code_syntax_const
   wfrec
-    ml ("{*wfrec*}?")
-    haskell ("{*wfrec*}?") *)
+    ml ("let fun wfrec f x = f (wfrec f) x in wfrec _ _ end;")
+    haskell ("wfrec _ _ where wfrec f x = f (wfrec f) x")
 
 subsection{*Variants for TFL: the Recdef Package*}