12169c2c3840ced2ecee902345ae811d16283c83
[clean-tests.git] / gengen / test.icl
1 module test
2
3 import StdEnv, StdGeneric
4
5 import Data.Func
6 import Data.Functor
7 import Data.List
8 import Data.Tuple
9 import Data.Bifunctor
10 import Data.Maybe
11 import Control.GenBimap
12 import Data.Either
13
14 import Data.GenType
15 import Data.GenType.CType
16
17 derive gType Either, T, R, Frac, Tr, Fix, Odd, Even, SR, List, Enum, NT, Blurp, EnumList
18
19 :: T a =: T2 a
20 :: NT =: NT Int
21 :: SR = {f1 :: Int, f2 :: Bool, f3 :: Tr Either Bool, f4 :: Enum}
22 :: R a = {f1 :: ? (R a), f2 :: Bool, f3 :: T a, f4 :: Char -> Dynamic,
23 f5 :: [([#Int], [#Int!], [!Int!], [!Int], [Int!])],
24 f6 :: ({!Int}, {R Bool}, {#Char}, {32#Int}),/*({!Int}, {#Char}, {R Bool})*/
25 f7 :: {!Int}}
26 :: Tr m b= Tr (m Int b)
27 :: Frac a = (/.) infixl 7 a a | Flurp
28 :: Fix f = Fix (f (Fix f))
29
30 :: List a = Cons a (List a) | Nil
31
32 :: Blurp a = Blurp (List a) | Blorp
33
34 :: EnumList = ECons Enum EnumList | ENil
35
36 ////Start :: [String]
37 ////Start = foldr (\i c->print i ["\n":c]) [] $ catMaybes $ map gTypeToType $ flattenGType $ unBox t
38 //:: Pair a b = Pair a b
39 //instance == (Pair a b) | == a where (==) (Pair a1 _) (Pair a2 _) = a1 == a2
40 //instance < (Pair a b) | < a where (<) (Pair a1 _) (Pair a2 _) = a1 < a2
41 :: Odd a = Odd (Even a) | OddBlurp
42 :: Even a = Even (Odd a) | EvenBlurp
43 :: Enum = A | B | C
44 Start =
45 ( flatTypedef $ gTypeToType $ unBox t
46 , typedefs $ map (map gTypeToType) $ map (filter (not o isBasic)) $ flattenGType $ unBox t
47 )
48
49 //Start = typedefs //$ (\x->[[gTypeToType x]])
50 // $ map (/*filter (not o isBuiltin) o*/ catMaybes o map gTypeToType)
51 // $ (\x->[[x]])
52 // $ map (map gTypeToType)
53 // $ map (filter (not o isBasic))
54 // $ flattenGType
55 // $ unBox t
56
57
58 //t :: Box GType (?# Int)
59 //t :: Box GType (Maybe [Maybe (Either Bool String)])
60 //t :: Box GType ([SR], Enum, T Int, NT, Blurp Int)
61 //t :: Box GType [EnumList]
62 t :: Box GType (?(?(?(?^Enum))))
63 //t :: Box GType (Odd Int, (), [Either (R (T *World)) (Frac Real)], Tr Either Bool, Fix Maybe)
64 t = gType{|*|}