monomorph structgen
[clean-tests.git] / test.icl
index 2350a9a..dddfbe1 100644 (file)
--- a/test.icl
+++ b/test.icl
@@ -1,52 +1,20 @@
 module test
 
-import StdEnv, StdGeneric
-import Data.Array
+import StdEnv
 
-Start :: [{!Int}]
-Start =
-       [ appendArr {!1,2,3} {!4,5,6,7}
-       , appendArr {!} {!}
-       , appendArr {!} {!1,2,3}
-       , appendArr {!1,2,3} {!}
-       ]
-/*
-derive bimap Box
+import graph_copy_with_names, symbols_in_program
+import System.CommandLine
 
-:: Box b a =: Box b
+test :: !{#Symbol} a -> a
+test symbols a
+       # (a, b, c) = copy_to_string_with_names a
+       # (a, r) = copy_from_string_with_names a b c symbols
+       = a
 
-unBox (Box b) :== b
-box b :== Box b
+polyid :: (A.a: a -> a) -> (Int, Bool)
+polyid f = (f 42, f True)
 
-generic gPotentialInf a :: [String] -> Box Bool a
-
-gPotentialInf{|World|} _ = box False
-gPotentialInf{|File|} _ = box False
-gPotentialInf{|Bool|} _ = box False
-gPotentialInf{|Char|} _ = box False
-gPotentialInf{|Real|} _ = box False
-gPotentialInf{|Int|} _ = box False
-gPotentialInf{|Dynamic|} _ = box False
-gPotentialInf{|(->)|} _ _ _ = box False
-gPotentialInf{|{}|} a m = box (unBox (a m))
-gPotentialInf{|{!}|} a m = box (unBox (a m))
-gPotentialInf{|{#}|} a m = box (unBox (a m))
-gPotentialInf{|UNIT|} _ = box False
-gPotentialInf{|EITHER|} l r m = box (unBox (l m) || unBox (r m))
-gPotentialInf{|PAIR|} l r m = box (unBox (l m) || unBox (r m))
-gPotentialInf{|CONS|} x m = box (unBox (x m))
-gPotentialInf{|FIELD|} x m = box (unBox (x m))
-gPotentialInf{|RECORD of {grd_name}|} x m
-       | isMember grd_name m = box True
-       = box (unBox (x [grd_name:m]))
-gPotentialInf{|OBJECT of {gtd_name}|} x m
-       | isMember gtd_name m = box True
-       = box (unBox (x [gtd_name:m]))
-
-//derive gPotentialInf Int,Bool,Char,Real,String,File,World,Dynamic
-derive gPotentialInf (),(,),(,,),(,,,),(,,,,),(,,,,,),(,,,,,,),(,,,,,,,),(,,,,,,,,),(,,,,,,,,,),(,,,,,,,,,,),(,,,,,,,,,,,),(,,,,,,,,,,,,),(,,,,,,,,,,,,,),(,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,)
-derive gPotentialInf {},{#},{!},[],[! ],[ !],[!!],[#],[#!]
-
-Start :: Box Bool *File
-Start = gPotentialInf{|*|} []
-*/
+Start w
+       # ([argv0:_], w) = getCommandLine w
+       # (symbols, w) = accFiles (read_symbols argv0) w
+       = test symbols (polyid id)