[project @ 1998-06-16 08:55:30 by sof]
authorsof <unknown>
Tue, 16 Jun 1998 08:55:32 +0000 (08:55 +0000)
committersof <unknown>
Tue, 16 Jun 1998 08:55:32 +0000 (08:55 +0000)
Don\'t generate con2tag, tag2con funs for newtype derivings

ghc/compiler/typecheck/TcDeriv.lhs
ghc/compiler/typecheck/TcInstDcls.lhs

index 6c45ca9..eb10d71 100644 (file)
@@ -676,12 +676,12 @@ gen_taggery_Names inst_infos
     
     do_con2tag acc_Names tycon
       | isDataTyCon tycon &&
-        (we_are_deriving eqClassKey tycon
+        ((we_are_deriving eqClassKey tycon
            && any isNullaryDataCon (tyConDataCons tycon))
         || (we_are_deriving ordClassKey  tycon
            && not (maybeToBool (maybeTyConSingleCon tycon)))
         || (we_are_deriving enumClassKey tycon)
-        || (we_are_deriving ixClassKey   tycon)
+        || (we_are_deriving ixClassKey   tycon))
        
       = returnTc ((con2tag_RDR tycon, tycon, GenCon2Tag)
                   : acc_Names)
@@ -689,14 +689,14 @@ gen_taggery_Names inst_infos
       = returnTc acc_Names
 
     do_tag2con acc_Names tycon
-      = if (we_are_deriving enumClassKey tycon)
-       || (we_are_deriving ixClassKey   tycon)
-       then
-         returnTc ( (tag2con_RDR tycon, tycon, GenTag2Con)
-                  : (maxtag_RDR  tycon, tycon, GenMaxTag)
-                  : acc_Names)
-       else
-         returnTc acc_Names
+      | isDataTyCon tycon &&
+         (we_are_deriving enumClassKey tycon ||
+         we_are_deriving ixClassKey   tycon)
+      = returnTc ( (tag2con_RDR tycon, tycon, GenTag2Con)
+                : (maxtag_RDR  tycon, tycon, GenMaxTag)
+                : acc_Names)
+      | otherwise
+      = returnTc acc_Names
 
     we_are_deriving clas_key tycon
       = is_in_eqns clas_key tycon all_CTs
index e3efa78..8e8f846 100644 (file)
@@ -429,7 +429,7 @@ tcInstDecl2 (InstInfo clas inst_tyvars inst_tys
 
        dict_rhs
          | null scs_and_meths
-         =     -- Blatant special case for CCallable, CReturnable
+         =     -- Blatant special case for CCallable, CReturnable [and Eval  -- sof 5/98]
                -- If the dictionary is empty then we should never
                -- select anything from it, so we make its RHS just
                -- emit an error message.  This in turn means that we don't