add ports
[mTask.git] / gCons.icl
index 3446116..3f13a7d 100644 (file)
--- a/gCons.icl
+++ b/gCons.icl
@@ -7,7 +7,7 @@ implementation module gCons
        ARDSL project
 */
 
-import StdEnv, StdGeneric
+import StdEnv, StdGeneric, GenBimap, _SystemStrictLists
 
 generic consName a :: a -> String
 consName{|CONS of {gcd_name}|} f x = gcd_name
@@ -35,3 +35,25 @@ consIndex{|Int|} i = i
 consIndex{|Bool|} b = if b 1 0
 consIndex{|Char|} c = toInt c
 consIndex{|String|} _ = 0
+
+generic conses a :: [a]
+conses{|CONS|} f = map CONS f
+conses{|UNIT|} = [UNIT]
+conses{|PAIR|} f g = []
+conses{|EITHER|} f g = map LEFT f ++ map RIGHT g
+conses{|OBJECT|} f = map OBJECT f
+conses{|RECORD|} f = map RECORD f
+conses{|FIELD|} f = map FIELD f
+conses{|Int|} = [0]
+conses{|Bool|} = [True]
+conses{|Char|} = ['\0']
+conses{|Real|} = [0.0]
+conses{|String|} = [""]
+conses{|[]|} _ = [[ ]]
+conses{|[!]|} _ = [[!]]
+conses{|[ !]|} _ = [[ !]]
+conses{|[!!]|} _ = [[!!]]
+conses{|{}|} _ = [{}]
+conses{|{!}|} _ = [{!}]
+conses{|()|} = [()]
+