[project @ 2001-03-19 16:22:00 by simonmar]
[ghc-hetmet.git] / ghc / compiler / prelude / PrelNames.lhs
index b0ca305..ba20d43 100644 (file)
@@ -38,8 +38,10 @@ module PrelNames (
 
 #include "HsVersions.h"
 
-import Module    ( ModuleName, mkPrelModule, mkModuleName )
-import OccName   ( NameSpace, UserFS, varName, dataName, tcName, clsName, mkKindOccFS )
+import Module    ( ModuleName, mkPrelModule, mkHomeModule, mkModuleName )
+import OccName   ( NameSpace, UserFS, varName, dataName, tcName, clsName, 
+                   mkKindOccFS, mkOccFS
+                 )
 import RdrName   ( RdrName, mkOrig, mkUnqual )
 import UniqFM
 import Unique    ( Unique, Uniquable(..), hasKey,
@@ -50,7 +52,7 @@ import BasicTypes ( Boxity(..), Arity )
 import UniqFM    ( UniqFM, listToUFM )
 import Name      ( Name, mkLocalName, mkKnownKeyGlobal, nameRdrName )
 import RdrName    ( rdrNameOcc )
-import SrcLoc     ( builtinSrcLoc )
+import SrcLoc     ( builtinSrcLoc, noSrcLoc )
 import Util      ( nOfThem )
 import Panic     ( panic )
 \end{code}
@@ -58,6 +60,29 @@ import Panic   ( panic )
 
 %************************************************************************
 %*                                                                     *
+\subsection{Local Names}
+%*                                                                     *
+%************************************************************************
+
+This *local* name is used by the interactive stuff
+
+\begin{code}
+itName uniq = mkLocalName uniq (mkOccFS varName SLIT("it")) noSrcLoc
+\end{code}
+
+\begin{code}
+-- mkUnboundName makes a place-holder Name; it shouldn't be looked at except possibly
+-- during compiler debugging.
+mkUnboundName :: RdrName -> Name
+mkUnboundName rdr_name = mkLocalName unboundKey (rdrNameOcc rdr_name) builtinSrcLoc
+
+isUnboundName :: Name -> Bool
+isUnboundName name = name `hasKey` unboundKey
+\end{code}
+
+
+%************************************************************************
+%*                                                                     *
 \subsection{Known key Names}
 %*                                                                     *
 %************************************************************************
@@ -129,6 +154,7 @@ knownKeyNames
        newStablePtrName,
        bindIOName,
        returnIOName,
+       failIOName,
 
        -- Strings and lists
        mapName,
@@ -157,6 +183,7 @@ knownKeyNames
        word64TyConName,
 
        -- Others
+       unsafeCoerceName,
        otherwiseIdName,
        plusIntegerName,
        timesIntegerName,
@@ -218,6 +245,8 @@ pREL_ERR            = mkPrelModule pREL_ERR_Name
 pREL_NUM       = mkPrelModule pREL_NUM_Name
 pREL_REAL      = mkPrelModule pREL_REAL_Name
 pREL_FLOAT     = mkPrelModule pREL_FLOAT_Name
+
+iNTERACTIVE     = mkHomeModule (mkModuleName "$Interactive")
 \end{code}
 
 %************************************************************************
@@ -337,6 +366,7 @@ genUnitTyConName   = tcQual   pREL_BASE_Name SLIT("Unit") genUnitTyConKey
 genUnitDataConName = dataQual pREL_BASE_Name SLIT("Unit") genUnitDataConKey
 
 -- Random PrelBase functions
+unsafeCoerceName  = varQual pREL_BASE_Name SLIT("unsafeCoerce") unsafeCoerceIdKey
 otherwiseIdName   = varQual pREL_BASE_Name SLIT("otherwise") otherwiseIdKey
 appendName       = varQual pREL_BASE_Name SLIT("++") appendIdKey
 foldrName        = varQual pREL_BASE_Name SLIT("foldr") foldrIdKey
@@ -427,6 +457,7 @@ ioTyConName   = tcQual   pREL_IO_BASE_Name SLIT("IO") ioTyConKey
 ioDataConName     = dataQual pREL_IO_BASE_Name SLIT("IO") ioDataConKey
 bindIOName       = varQual  pREL_IO_BASE_Name SLIT("bindIO") bindIOIdKey
 returnIOName     = varQual  pREL_IO_BASE_Name SLIT("returnIO") returnIOIdKey
+failIOName       = varQual  pREL_IO_BASE_Name SLIT("failIO") failIOIdKey
 
 -- IO things
 printName        = varQual pREL_IO_Name SLIT("print") printIdKey
@@ -799,6 +830,7 @@ getTagIdKey               = mkPreludeMiscIdUnique 40
 plusIntegerIdKey             = mkPreludeMiscIdUnique 41
 timesIntegerIdKey            = mkPreludeMiscIdUnique 42
 printIdKey                   = mkPreludeMiscIdUnique 43
+failIOIdKey                  = mkPreludeMiscIdUnique 44
 \end{code}
 
 Certain class operations from Prelude classes.  They get their own
@@ -1022,12 +1054,3 @@ noDictClassKeys  -- These classes are used only for type annotations;
   = cCallishClassKeys
 \end{code}
 
-\begin{code}
--- mkUnboundName makes a place-holder Name; it shouldn't be looked at except possibly
--- during compiler debugging.
-mkUnboundName :: RdrName -> Name
-mkUnboundName rdr_name = mkLocalName unboundKey (rdrNameOcc rdr_name) builtinSrcLoc
-
-isUnboundName :: Name -> Bool
-isUnboundName name = name `hasKey` unboundKey
-\end{code}