ue
[clean-tests.git] / test2.icl
index a1876a8..d349f1b 100644 (file)
--- a/test2.icl
+++ b/test2.icl
@@ -1,3 +1,21 @@
-module test2
+module test
 
-Start = 42
+import Data.Func
+import StdEnv, StdGeneric
+
+:: IsR a = IsR Bool | IsROnzin a
+unIsR (IsR b) = b
+generic gIsRecursive a :: [String] -> IsR a
+gIsRecursive{|Int|} _ = IsR False
+gIsRecursive{|UNIT|} _ = IsR False
+gIsRecursive{|EITHER|} l r m = IsR $ unIsR (l m) || unIsR (r m)
+gIsRecursive{|PAIR|} l r m = IsR $ unIsR (l m) || unIsR (r m)
+gIsRecursive{|CONS|} x m = IsR $ unIsR (x m)
+gIsRecursive{|OBJECT of gtd|} x m
+       | isMember gtd.gtd_name m = IsR True
+       = IsR $ unIsR (x m)
+
+derive gIsRecursive []
+
+Start :: IsR [Int]
+Start = gIsRecursive{|*|} []