remove empty dir
[ghc-hetmet.git] / ghc / compiler / prelude / PrelInfo.lhs
index c6afe14..31457b2 100644 (file)
@@ -5,18 +5,17 @@
 
 \begin{code}
 module PrelInfo (
-       module PrelNames,
        module MkId,
 
-       wiredInThingEnv,
        ghcPrimExports,
-       knownKeyNames,
+       wiredInThings, basicKnownKeyNames,
+       primOpId,
        
        -- Random other things
        maybeCharLikeCon, maybeIntLikeCon,
 
        -- Class categories
-       isNoDictClass, isNumericClass, isStandardClass
+       isNumericClass, isStandardClass
 
     ) where
 
@@ -24,30 +23,23 @@ module PrelInfo (
 
 import PrelNames       ( basicKnownKeyNames, 
                          hasKey, charDataConKey, intDataConKey,
-                         numericClassKeys, standardClassKeys,
-                         noDictClassKeys )
-#ifdef GHCI
-import DsMeta          ( templateHaskellNames )
-import NameSet         ( nameSetToList )
-#endif
-
-import PrimOp          ( allThePrimOps, primOpOcc )
+                         numericClassKeys, standardClassKeys )
+
+import PrimOp          ( PrimOp, allThePrimOps, primOpOcc, primOpTag, maxPrimOpTag )
 import DataCon         ( DataCon )
-import Id              ( idName )
+import Id              ( Id, idName )
 import MkId            ( mkPrimOpId, wiredInIds )
 import MkId            -- All of it, for re-export
-import Name            ( Name, nameOccName, NamedThing(..) )
-import RdrName         ( mkRdrUnqual )
-import HsSyn           ( HsTyVarBndr(..) )
-import OccName         ( mkVarOcc )
+import Name            ( nameOccName )
 import TysPrim         ( primTyCons )
 import TysWiredIn      ( wiredInTyCons )
-import HscTypes        ( TyThing(..), implicitTyThings, TypeEnv, mkTypeEnv,
-                         GenAvailInfo(..), RdrAvailInfo )
-import Class           ( Class, classKey, className )
-import Type            ( funTyCon, openTypeKind, liftedTypeKind )
+import HscTypes        ( TyThing(..), implicitTyThings, GenAvailInfo(..), RdrAvailInfo )
+import Class           ( Class, classKey )
+import Type            ( funTyCon )
 import TyCon           ( tyConName )
 import Util            ( isIn )
+
+import Array           ( Array, array, (!) )
 \end{code}
 
 %************************************************************************
@@ -61,11 +53,11 @@ We have two ``builtin name funs,'' one to look up @TyCons@ and
 
 \begin{code}
 wiredInThings :: [TyThing]
-wiredInThings
+wiredInThings          
   = concat
     [          -- Wired in TyCons and their implicit Ids
          tycon_things
-       , implicitTyThings tycon_things
+       , concatMap implicitTyThings tycon_things
 
                -- Wired in Ids
        , map AnId wiredInIds
@@ -75,17 +67,6 @@ wiredInThings
     ]
   where
     tycon_things = map ATyCon ([funTyCon] ++ primTyCons ++ wiredInTyCons)
-
-wiredInThingEnv :: TypeEnv
-wiredInThingEnv = mkTypeEnv wiredInThings
-
-knownKeyNames :: [Name]
-knownKeyNames 
-  = map getName wiredInThings 
-    ++ basicKnownKeyNames
-#ifdef GHCI
-    ++ nameSetToList templateHaskellNames
-#endif
 \end{code}
 
 We let a lot of "non-standard" values be visible, so that we can make
@@ -94,6 +75,22 @@ sense of them in interface pragmas. It's cool, though they all have
 
 %************************************************************************
 %*                                                                     *
+               PrimOpIds
+%*                                                                     *
+%************************************************************************
+
+\begin{code}
+primOpIds :: Array Int Id      -- Indexed by PrimOp tag
+primOpIds = array (1,maxPrimOpTag) [ (primOpTag op, mkPrimOpId op) 
+                                  | op <- allThePrimOps]
+
+primOpId :: PrimOp -> Id
+primOpId op = primOpIds ! primOpTag op
+\end{code}
+
+
+%************************************************************************
+%*                                                                     *
 \subsection{Export lists for pseudo-modules (GHC.Prim)}
 %*                                                                     *
 %************************************************************************
@@ -103,15 +100,12 @@ wired-in Ids.
 
 \begin{code}
 ghcPrimExports :: [RdrAvailInfo]
+ghcPrimExports
  = map (Avail . nameOccName . idName) ghcPrimIds ++
    map (Avail . primOpOcc) allThePrimOps ++
    [ AvailTC occ [occ] |
      n <- funTyCon : primTyCons, let occ = nameOccName (tyConName n) 
    ]
-
-alpha = mkRdrUnqual (mkVarOcc FSLIT("a"))
-openAlpha = IfaceTyVar alpha openTypeKind
-liftedAlpha = IfaceTyVar alpha liftedTypeKind
 \end{code}
 
 
@@ -137,10 +131,9 @@ maybeIntLikeCon  con = con `hasKey` intDataConKey
 %************************************************************************
 
 \begin{code}
-isNoDictClass, isNumericClass, isStandardClass :: Class -> Bool
+isNumericClass, isStandardClass :: Class -> Bool
 
 isNumericClass     clas = classKey clas `is_elem` numericClassKeys
 isStandardClass    clas = classKey clas `is_elem` standardClassKeys
-isNoDictClass      clas = classKey clas `is_elem` noDictClassKeys
 is_elem = isIn "is_X_Class"
 \end{code}