[project @ 2000-01-12 14:52:53 by sewardj]
authorsewardj <unknown>
Wed, 12 Jan 2000 14:52:54 +0000 (14:52 +0000)
committersewardj <unknown>
Wed, 12 Jan 2000 14:52:54 +0000 (14:52 +0000)
Clear up confusion regarding names of tuple types.
-- (), coded as Z0T, is the unit.
-- (,), coded as Z1T, is the pair type.
-- (,,,N commas,,,) coded as ZNT, is the (N+1)-tuple type.
-- There is no 1-ary type type.

ghc/interpreter/link.c
ghc/interpreter/storage.c
ghc/interpreter/type.c

index 1fc2473..5d8e40b 100644 (file)
@@ -9,8 +9,8 @@
  * included in the distribution.
  *
  * $RCSfile: link.c,v $
- * $Revision: 1.36 $
- * $Date: 2000/01/12 10:44:50 $
+ * $Revision: 1.37 $
+ * $Date: 2000/01/12 14:52:53 $
  * ------------------------------------------------------------------------*/
 
 #include "prelude.h"
@@ -381,15 +381,15 @@ assert(nonNull(typeInteger));
        */
         name(namePrimTakeMVar).type = primType(MONAD_Id, "rbc", "d");
 
-        if (combined) {
-        for (i=2; i<=NUM_DTUPLES; i++) {/* Add derived instances of tuples */
-            addTupInst(classEq,i);
-            addTupInst(classOrd,i);
-            addTupInst(classIx,i);
-            addTupInst(classShow,i);
-            addTupInst(classRead,i);
-            addTupInst(classBounded,i);
-        }
+        if (!combined) {
+           for (i=2; i<=NUM_DTUPLES; i++) {/* Add derived instances of tuples */
+               addTupInst(classEq,i);
+               addTupInst(classOrd,i);
+               addTupInst(classIx,i);
+               addTupInst(classShow,i);
+               addTupInst(classRead,i);
+               addTupInst(classBounded,i);
+           }
         }
     }
 }
@@ -429,10 +429,10 @@ Void linkPreludeCM(void) {              /* Hook to cfuns and mfuns in      */
         nameInRange      = linkName("inRange");
         nameMinus        = linkName("-");
         /* These come before calls to implementPrim */
-        if (combined) {
-        for(i=0; i<NUM_TUPLES; ++i) {
-            implementTuple(i);
-        }
+        if (!combined) {
+           for(i=0; i<NUM_TUPLES; ++i) {
+               if (i != 1) implementTuple(i);
+           }
         }
     }
 }
@@ -551,7 +551,7 @@ Int what; {
                        = addWiredInBoxingTycon("PrelGHC","ByteArray","PrimByteArray#",0 ,STAR );
 
                for (i=0; i<NUM_TUPLES; ++i) {
-                   addTupleTycon(i);
+                   if (i != 1) addTupleTycon(i);
                }
               addWiredInEnumTycon("PrelBase","Bool",
                                    doubleton(findText("False"),findText("True")));
@@ -575,7 +575,7 @@ Int what; {
                setCurrModule(modulePrelude);
         
                for (i=0; i<NUM_TUPLES; ++i) {
-                   addTupleTycon(i);
+                   if (i != 1) addTupleTycon(i);
                }
                setCurrModule(modulePrelude);
 
index 9d10e43..3443061 100644 (file)
@@ -9,8 +9,8 @@
  * included in the distribution.
  *
  * $RCSfile: storage.c,v $
- * $Revision: 1.39 $
- * $Date: 2000/01/11 17:23:39 $
+ * $Revision: 1.40 $
+ * $Date: 2000/01/12 14:52:53 $
  * ------------------------------------------------------------------------*/
 
 #include "prelude.h"
@@ -599,13 +599,15 @@ List   ts; {                            /* Null pattern matches every tycon*/
 
 Text ghcTupleText_n ( Int n )
 {
-    Int  i;
+    Int i;
+    Int x = 0; 
     char buf[104];
     if (n < 0 || n >= 100) internal("ghcTupleText_n");
-    buf[0] = '(';
-    for (i = 1; i <= n; i++) buf[i] = ',';
-    buf[n+1] = ')';
-    buf[n+2] = 0;
+    if (n == 1) internal("ghcTupleText_n==1");
+    buf[x++] = '(';
+    for (i = 1; i <= n-1; i++) buf[x++] = ',';
+    buf[x++] = ')';
+    buf[x++] = 0;
     return findText(buf);
 }
 
index e2f8277..2446ce0 100644 (file)
@@ -9,8 +9,8 @@
  * included in the distribution.
  *
  * $RCSfile: type.c,v $
- * $Revision: 1.21 $
- * $Date: 2000/01/07 17:49:29 $
+ * $Revision: 1.22 $
+ * $Date: 2000/01/12 14:52:54 $
  * ------------------------------------------------------------------------*/
 
 #include "prelude.h"
@@ -2847,9 +2847,7 @@ Int what; {
 
                starToStar   = simpleKind(1);
 
-               typeUnit     = //addPrimTycon(findText("()"),
-                              //             STAR,0,DATATYPE,NIL);
-                              findTycon(findText("()"));
+               typeUnit     = findTycon(findText("()"));
                               assert(nonNull(typeUnit));
 
                typeArrow    = addPrimTycon(findText("(->)"),