[project @ 2002-04-29 14:03:38 by simonmar]
[ghc-hetmet.git] / ghc / compiler / types / Generics.lhs
index d961aa8..b868c2a 100644 (file)
@@ -39,6 +39,7 @@ import SrcLoc         ( builtinSrcLoc )
 import Unique          ( Unique, builtinUniques, mkBuiltinUnique )
 import Util             ( takeList, dropList )
 import Outputable 
+import FastString
 
 #include "HsVersions.h"
 \end{code}
@@ -254,8 +255,12 @@ mkTyConGenInfo tycon [from_name, to_name]
        | dc <- datacons ]
   = Nothing
 
+  | null datacons      -- There are no constructors; 
+  = Nothing            -- there are no values of this type
+
   | otherwise
-  = Just (EP { fromEP = mkVanillaGlobal from_name from_ty from_id_info,
+  = ASSERT( not (null datacons) )      -- mk_sum_stuff loops if no datacons
+    Just (EP { fromEP = mkVanillaGlobal from_name from_ty from_id_info,
               toEP   = mkVanillaGlobal to_name   to_ty   to_id_info })
   where
     maybe_datacons = tyConDataCons_maybe tycon
@@ -550,7 +555,7 @@ bimapTuple eps
 
 -------------------
 genericNames :: [Name]
-genericNames = [mkSystemName (mkBuiltinUnique i) (_PK_ ('g' : show i)) | i <- [1..]]
+genericNames = [mkSystemName (mkBuiltinUnique i) (mkFastString ('g' : show i)) | i <- [1..]]
 (g1:g2:g3:_) = genericNames
 
 mk_hs_lam pats body = HsPar (HsLam (mkSimpleMatch pats body placeHolderType builtinSrcLoc))