[project @ 2000-11-14 08:07:11 by simonpj]
[ghc-hetmet.git] / ghc / compiler / prelude / PrelInfo.lhs
index 8c5ceb6..f1a64ed 100644 (file)
@@ -37,15 +37,13 @@ import MkId         ( mkPrimOpId, wiredInIds )
 import MkId            -- All of it, for re-export
 import TysPrim         ( primTyCons )
 import TysWiredIn      ( wiredInTyCons )
-import HscTypes        ( TyThing(..) )
+import HscTypes        ( TyThing(..), TypeEnv, mkTypeEnv )
 
 -- others:
-import Name            ( getName, NameEnv, mkNameEnv )
-import TyCon           ( tyConDataConsIfAvailable, TyCon )
+import TyCon           ( tyConDataConsIfAvailable, tyConGenIds, TyCon )
 import Class           ( Class, classKey )
 import Type            ( funTyCon )
 import Util            ( isIn )
-import Outputable      ( ppr, pprPanic )
 \end{code}
 
 %************************************************************************
@@ -72,13 +70,17 @@ wiredInThings
     ]
 
 wiredInTyConThings :: TyCon -> [TyThing]
+-- This is a bit of a cheat (c.f. TcTyDecls.mkImplicitDataBinds
+-- It assumes that wired in tycons have no record selectors
 wiredInTyConThings tc
-   = ATyCon tc : [ AnId n | dc <- tyConDataConsIfAvailable tc, 
-                            n  <- [dataConId dc, dataConWrapId dc] ]
+   = [ATyCon tc] 
+   ++ [ AnId i | i <- tyConGenIds tc ]
+   ++ [ AnId n | dc <- tyConDataConsIfAvailable tc, 
+                 n  <- [dataConId dc, dataConWrapId dc] ] 
                        -- Synonyms return empty list of constructors
 
-wiredInThingEnv :: NameEnv TyThing
-wiredInThingEnv = mkNameEnv [ (getName thing, thing) | thing <- wiredInThings ]
+wiredInThingEnv :: TypeEnv
+wiredInThingEnv = mkTypeEnv wiredInThings
 \end{code}
 
 We let a lot of "non-standard" values be visible, so that we can make