X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=test3.icl;fp=test3.icl;h=0b6455a5f8bec581029ed99a22762961420f350b;hb=8ff537028a2955ede52506d13628c2d3faede6ed;hp=0000000000000000000000000000000000000000;hpb=dfcca36a36a964320436b622d18bce909ed5a9fc;p=clean-tests.git diff --git a/test3.icl b/test3.icl new file mode 100644 index 0000000..0b6455a --- /dev/null +++ b/test3.icl @@ -0,0 +1,33 @@ +module test + +import Data.Func +import StdEnv, StdGeneric + +:: IsR a = IsR Bool | IsROnzin a +unIsR (IsR b) = b +generic gIsRecursive a :: [String] -> IsR a +gIsRecursive{|Bool|} _ = IsR False +gIsRecursive{|Char|} _ = IsR False +gIsRecursive{|Real|} _ = IsR False +gIsRecursive{|Int|} _ = IsR False +gIsRecursive{|{}|} a m = IsR $ unIsR (a m) +gIsRecursive{|{!}|} a m = IsR $ unIsR (a m) +gIsRecursive{|{!!}|} a m = IsR $ unIsR (a m) +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{|FIELD|} x m = IsR $ unIsR (x m) +gIsRecursive{|RECORD of grd|} x m + | isMember grd.grd_name m = IsR True + = IsR $ unIsR (x [grd.grd_name:m]) +gIsRecursive{|OBJECT of gtd|} x m + | isMember gtd.gtd_name m = IsR True + = IsR $ unIsR (x [gtd.gtd_name:m]) + +:: R = {f1 :: Int, f2 :: Bool, f3 :: [R]} +derive gIsRecursive [], R + +//Start :: IsR [Int] +Start :: IsR R +Start = gIsRecursive{|*|} []