-
[clean-tests.git] / old / test3.icl
1 module test
2
3 import Data.Func
4 import StdEnv, StdGeneric
5
6 :: IsR a = IsR Bool | IsROnzin a
7 unIsR (IsR b) = b
8 generic gIsRecursive a :: [String] -> IsR a
9 gIsRecursive{|Bool|} _ = IsR False
10 gIsRecursive{|Char|} _ = IsR False
11 gIsRecursive{|Real|} _ = IsR False
12 gIsRecursive{|Int|} _ = IsR False
13 gIsRecursive{|{}|} a m = IsR $ unIsR (a m)
14 gIsRecursive{|{!}|} a m = IsR $ unIsR (a m)
15 gIsRecursive{|{!!}|} a m = IsR $ unIsR (a m)
16 gIsRecursive{|UNIT|} _ = IsR False
17 gIsRecursive{|EITHER|} l r m = IsR $ unIsR (l m) || unIsR (r m)
18 gIsRecursive{|PAIR|} l r m = IsR $ unIsR (l m) || unIsR (r m)
19 gIsRecursive{|CONS|} x m = IsR $ unIsR (x m)
20 gIsRecursive{|FIELD|} x m = IsR $ unIsR (x m)
21 gIsRecursive{|RECORD of grd|} x m
22 | isMember grd.grd_name m = IsR True
23 = IsR $ unIsR (x [grd.grd_name:m])
24 gIsRecursive{|OBJECT of gtd|} x m
25 | isMember gtd.gtd_name m = IsR True
26 = IsR $ unIsR (x [gtd.gtd_name:m])
27
28 :: R = {f1 :: Int, f2 :: Bool, f3 :: [R]}
29 derive gIsRecursive [], R
30
31 //Start :: IsR [Int]
32 Start :: IsR R
33 Start = gIsRecursive{|*|} []