[project @ 1997-03-14 07:52:06 by simonpj]
[ghc-hetmet.git] / ghc / compiler / prelude / PrelVals.lhs
index 30f24db..046e6fa 100644 (file)
@@ -9,8 +9,8 @@
 module PrelVals where
 
 IMP_Ubiq()
 module PrelVals where
 
 IMP_Ubiq()
-IMPORT_DELOOPER(IdLoop)                ( UnfoldingGuidance(..) )
-import Id              ( Id(..), GenId, mkImported, mkUserId, mkTemplateLocals )
+IMPORT_DELOOPER(IdLoop)                ( UnfoldingGuidance(..), nullSpecEnv, SpecEnv )
+import Id              ( SYN_IE(Id), GenId, mkImported, mkTemplateLocals )
 IMPORT_DELOOPER(PrelLoop)
 
 -- friends:
 IMPORT_DELOOPER(PrelLoop)
 
 -- friends:
@@ -19,45 +19,34 @@ import TysPrim
 import TysWiredIn
 
 -- others:
 import TysWiredIn
 
 -- others:
-import CmdLineOpts     ( maybe_CompilingPrelude )
+import CmdLineOpts     ( maybe_CompilingGhcInternals )
 import CoreSyn         -- quite a bit
 import IdInfo          -- quite a bit
 import Literal         ( mkMachInt )
 import CoreSyn         -- quite a bit
 import IdInfo          -- quite a bit
 import Literal         ( mkMachInt )
+import Name            ( mkWiredInIdName )
 import PragmaInfo
 import PrimOp          ( PrimOp(..) )
 import PragmaInfo
 import PrimOp          ( PrimOp(..) )
-import SpecEnv         ( SpecEnv(..), nullSpecEnv )
 import Type            ( mkTyVarTy )
 import TyVar           ( openAlphaTyVar, alphaTyVar, betaTyVar, gammaTyVar )
 import Unique          -- lots of *Keys
 import Util            ( panic )
 \end{code}
 
 import Type            ( mkTyVarTy )
 import TyVar           ( openAlphaTyVar, alphaTyVar, betaTyVar, gammaTyVar )
 import Unique          -- lots of *Keys
 import Util            ( panic )
 \end{code}
 
-
-
-
 \begin{code}
 -- only used herein:
 \begin{code}
 -- only used herein:
-pcMiscPrelId :: Unique{-IdKey-} -> FAST_STRING -> FAST_STRING -> Type -> IdInfo -> Id
+pcMiscPrelId :: Unique{-IdKey-} -> Module -> FAST_STRING -> Type -> IdInfo -> Id
 
 
-pcMiscPrelId key m n ty info
+pcMiscPrelId key mod occ ty info
   = let
   = let
-       name = mkWiredInName key (OrigName m n)
+       name = mkWiredInIdName key mod occ imp
        imp  = mkImported name ty info -- the usual case...
     in
     imp
     -- We lie and say the thing is imported; otherwise, we get into
     -- a mess with dependency analysis; e.g., core2stg may heave in
        imp  = mkImported name ty info -- the usual case...
     in
     imp
     -- We lie and say the thing is imported; otherwise, we get into
     -- a mess with dependency analysis; e.g., core2stg may heave in
-    -- random calls to GHCbase.unpackPS.  If GHCbase is the module
+    -- random calls to GHCbase.unpackPS__.  If GHCbase is the module
     -- being compiled, then it's just a matter of luck if the definition
     -- will be in "the right place" to be in scope.
     -- being compiled, then it's just a matter of luck if the definition
     -- will be in "the right place" to be in scope.
-{- ???
-    case maybe_CompilingPrelude of
-      Nothing -> imp
-      Just modname ->
-       if modname == _UNPK_ m -- we are compiling the module where this thing is defined...
-       then mkUserId name ty NoPragmaInfo
-       else imp
--}
 \end{code}
 
 %************************************************************************
 \end{code}
 
 %************************************************************************
@@ -84,14 +73,14 @@ templates, but we don't ever expect to generate code for it.
 pc_bottoming_Id key mod name ty
  = pcMiscPrelId key mod name ty bottoming_info
  where
 pc_bottoming_Id key mod name ty
  = pcMiscPrelId key mod name ty bottoming_info
  where
-    bottoming_info = noIdInfo `addInfo` mkBottomStrictnessInfo
+    bottoming_info = noIdInfo `addStrictnessInfo` mkBottomStrictnessInfo
        -- these "bottom" out, no matter what their arguments
 
 eRROR_ID
        -- these "bottom" out, no matter what their arguments
 
 eRROR_ID
-  = pc_bottoming_Id errorIdKey pRELUDE SLIT("error") errorTy
+  = pc_bottoming_Id errorIdKey iO_BASE SLIT("error") errorTy
 
 generic_ERROR_ID u n
 
 generic_ERROR_ID u n
-  = pc_bottoming_Id u gHC__ n errorTy
+  = pc_bottoming_Id u gHC_ERR n errorTy
 
 pAT_ERROR_ID
   = generic_ERROR_ID patErrorIdKey SLIT("patError")
 
 pAT_ERROR_ID
   = generic_ERROR_ID patErrorIdKey SLIT("patError")
@@ -109,28 +98,30 @@ nO_EXPLICIT_METHOD_ERROR_ID
   = generic_ERROR_ID nonExplicitMethodErrorIdKey SLIT("noExplicitMethodError")
 
 aBSENT_ERROR_ID
   = generic_ERROR_ID nonExplicitMethodErrorIdKey SLIT("noExplicitMethodError")
 
 aBSENT_ERROR_ID
-  = pc_bottoming_Id absentErrorIdKey gHC__ SLIT("absentErr")
-       (mkSigmaTy [alphaTyVar] [] alphaTy)
+  = pc_bottoming_Id absentErrorIdKey gHC_ERR SLIT("absentErr")
+       (mkSigmaTy [openAlphaTyVar] [] openAlphaTy)
 
 pAR_ERROR_ID
 
 pAR_ERROR_ID
-  = pcMiscPrelId parErrorIdKey gHC__ SLIT("parError")
-    (mkSigmaTy [alphaTyVar] [] alphaTy) noIdInfo
+  = pcMiscPrelId parErrorIdKey gHC_ERR SLIT("parError")
+    (mkSigmaTy [openAlphaTyVar] [] openAlphaTy) noIdInfo
+
+openAlphaTy = mkTyVarTy openAlphaTyVar
 
 errorTy  :: Type
 
 errorTy  :: Type
-errorTy  = mkSigmaTy [openAlphaTyVar] [] (mkFunTys [mkListTy charTy] (mkTyVarTy openAlphaTyVar))
+errorTy  = mkSigmaTy [openAlphaTyVar] [] (mkFunTys [mkListTy charTy] openAlphaTy)
+    -- Notice the openAlphaTyVar.  It says that "error" can be applied
+    -- to unboxed as well as boxed types.  This is OK because it never
+    -- returns, so the return type is irrelevant.
 \end{code}
 
 \end{code}
 
-We want \tr{_trace} (NB: name not in user namespace) to be wired in
+We want \tr{GHCbase.trace} to be wired in
 because we don't want the strictness analyser to get ahold of it,
 decide that the second argument is strict, evaluate that first (!!),
 because we don't want the strictness analyser to get ahold of it,
 decide that the second argument is strict, evaluate that first (!!),
-and make a jolly old mess.  Having \tr{_trace} wired in also helps when
-attempting to re-export it---because it's in \tr{PreludeBuiltin}, it
-won't get an \tr{import} declaration in the interface file, so the
-importing-subsequently module needs to know it's magic.
+and make a jolly old mess.
 \begin{code}
 tRACE_ID
 \begin{code}
 tRACE_ID
-  = pcMiscPrelId traceIdKey gHC__ SLIT("trace") traceTy
-       (noIdInfo `addInfo` pcGenerateSpecs traceIdKey tRACE_ID noIdInfo traceTy)
+  = pcMiscPrelId traceIdKey iO_BASE SLIT("trace") traceTy
+       (noIdInfo `addSpecInfo` pcGenerateSpecs traceIdKey tRACE_ID noIdInfo traceTy)
   where
     traceTy = mkSigmaTy [alphaTyVar] [] (mkFunTys [mkListTy charTy, alphaTy] alphaTy)
 \end{code}
   where
     traceTy = mkSigmaTy [alphaTyVar] [] (mkFunTys [mkListTy charTy, alphaTy] alphaTy)
 \end{code}
@@ -143,54 +134,55 @@ tRACE_ID
 
 \begin{code}
 packStringForCId
 
 \begin{code}
 packStringForCId
-  = pcMiscPrelId packCStringIdKey{-ToDo:rename-} gHC__ SLIT("packStringForC")
+  = pcMiscPrelId packCStringIdKey{-ToDo:rename-} pACKED_STRING SLIT("packCString#")
        (mkFunTys [stringTy] byteArrayPrimTy) noIdInfo
 
 --------------------------------------------------------------------
 
 unpackCStringId
        (mkFunTys [stringTy] byteArrayPrimTy) noIdInfo
 
 --------------------------------------------------------------------
 
 unpackCStringId
-  = pcMiscPrelId unpackCStringIdKey gHC__ SLIT("unpackPS")
+  = pcMiscPrelId unpackCStringIdKey pACKED_STRING SLIT("unpackCString#")
                 (mkFunTys [addrPrimTy{-a char *-}] stringTy) noIdInfo
 -- Andy says:
                 (mkFunTys [addrPrimTy{-a char *-}] stringTy) noIdInfo
 -- Andy says:
---     (FunTy addrPrimTy{-a char *-} stringTy) (noIdInfo `addInfo` mkArityInfo 1)
+--     (FunTy addrPrimTy{-a char *-} stringTy) (noIdInfo `addInfo` exactArity 1)
 -- but I don't like wired-in IdInfos (WDP)
 
 unpackCString2Id -- for cases when a string has a NUL in it
 -- but I don't like wired-in IdInfos (WDP)
 
 unpackCString2Id -- for cases when a string has a NUL in it
-  = pcMiscPrelId unpackCString2IdKey gHC__ SLIT("unpackPS2")
+  = pcMiscPrelId unpackCString2IdKey pACKED_STRING SLIT("unpackCString2#")
                 (mkFunTys [addrPrimTy{-a char *-}, intPrimTy{-length-}] stringTy)
                 noIdInfo
 
 --------------------------------------------------------------------
 unpackCStringAppendId
                 (mkFunTys [addrPrimTy{-a char *-}, intPrimTy{-length-}] stringTy)
                 noIdInfo
 
 --------------------------------------------------------------------
 unpackCStringAppendId
-  = pcMiscPrelId unpackCStringAppendIdKey gHC__ SLIT("unpackAppendPS")
+  = pcMiscPrelId unpackCStringAppendIdKey pACKED_STRING SLIT("unpackAppendCString#")
                (mkFunTys [addrPrimTy{-a "char *" pointer-},stringTy] stringTy)
                ((noIdInfo
                (mkFunTys [addrPrimTy{-a "char *" pointer-},stringTy] stringTy)
                ((noIdInfo
-                {-LATER:`addInfo_UF` mkMagicUnfolding unpackCStringAppendIdKey-})
-                `addInfo` mkArityInfo 2)
+                {-LATER:`addUnfoldInfo` mkMagicUnfolding unpackCStringAppendIdKey-})
+                `addArityInfo` exactArity 2)
 
 unpackCStringFoldrId
 
 unpackCStringFoldrId
-  = pcMiscPrelId unpackCStringFoldrIdKey gHC__ SLIT("unpackFoldrPS")
+  = pcMiscPrelId unpackCStringFoldrIdKey pACKED_STRING SLIT("unpackFoldrCString#")
                (mkSigmaTy [alphaTyVar] []
                (mkFunTys [addrPrimTy{-a "char *" pointer-},
                           mkFunTys [charTy, alphaTy] alphaTy,
                           alphaTy]
                          alphaTy))
                ((noIdInfo
                (mkSigmaTy [alphaTyVar] []
                (mkFunTys [addrPrimTy{-a "char *" pointer-},
                           mkFunTys [charTy, alphaTy] alphaTy,
                           alphaTy]
                          alphaTy))
                ((noIdInfo
-                {-LATER:`addInfo_UF` mkMagicUnfolding unpackCStringFoldrIdKey-})
-                `addInfo` mkArityInfo 3)
+                {-LATER:`addUnfoldInfo` mkMagicUnfolding unpackCStringFoldrIdKey-})
+                `addArityInfo` exactArity 3)
 \end{code}
 
 OK, this is Will's idea: we should have magic values for Integers 0,
 +1, +2, and -1 (go ahead, fire me):
 \end{code}
 
 OK, this is Will's idea: we should have magic values for Integers 0,
 +1, +2, and -1 (go ahead, fire me):
+
 \begin{code}
 integerZeroId
 \begin{code}
 integerZeroId
-  = pcMiscPrelId integerZeroIdKey     gHC__ SLIT("integer_0")  integerTy noIdInfo
+  = pcMiscPrelId integerZeroIdKey     pREL_NUM SLIT("integer_0")  integerTy noIdInfo
 integerPlusOneId
 integerPlusOneId
-  = pcMiscPrelId integerPlusOneIdKey  gHC__ SLIT("integer_1")  integerTy noIdInfo
+  = pcMiscPrelId integerPlusOneIdKey  pREL_NUM SLIT("integer_1")  integerTy noIdInfo
 integerPlusTwoId
 integerPlusTwoId
-  = pcMiscPrelId integerPlusTwoIdKey  gHC__ SLIT("integer_2")  integerTy noIdInfo
+  = pcMiscPrelId integerPlusTwoIdKey  pREL_NUM SLIT("integer_2")  integerTy noIdInfo
 integerMinusOneId
 integerMinusOneId
-  = pcMiscPrelId integerMinusOneIdKey gHC__ SLIT("integer_m1") integerTy noIdInfo
+  = pcMiscPrelId integerMinusOneIdKey pREL_NUM SLIT("integer_m1") integerTy noIdInfo
 \end{code}
 
 %************************************************************************
 \end{code}
 
 %************************************************************************
@@ -200,6 +192,7 @@ integerMinusOneId
 %************************************************************************
 
 \begin{code}
 %************************************************************************
 
 \begin{code}
+{- OUT:
 --------------------------------------------------------------------
 -- seqId :: "seq", used w/ GRIP, etc., is really quite similar to
 -- dangerousEval
 --------------------------------------------------------------------
 -- seqId :: "seq", used w/ GRIP, etc., is really quite similar to
 -- dangerousEval
@@ -215,10 +208,10 @@ integerMinusOneId
 
 -}
 
 
 -}
 
-seqId = pcMiscPrelId seqIdKey gHC__ SLIT("seq")
+seqId = pcMiscPrelId seqIdKey pRELUDE SLIT("seq")
                  (mkSigmaTy [alphaTyVar, betaTyVar] []
                    (mkFunTys [alphaTy, betaTy] betaTy))
                  (mkSigmaTy [alphaTyVar, betaTyVar] []
                    (mkFunTys [alphaTy, betaTy] betaTy))
-                 (noIdInfo `addInfo_UF` (mkUnfolding EssentialUnfolding seq_template))
+                 (noIdInfo `addUnfoldInfo` (mkUnfolding True seq_template))
   where
     [x, y, z]
       = mkTemplateLocals [
   where
     [x, y, z]
       = mkTemplateLocals [
@@ -250,10 +243,10 @@ seqId = pcMiscPrelId seqIdKey gHC__ SLIT("seq")
     par = /\ a b -> \ x::a y::b -> case par# x of { 0# -> parError#; _ -> y; }
 
 -}
     par = /\ a b -> \ x::a y::b -> case par# x of { 0# -> parError#; _ -> y; }
 
 -}
-parId = pcMiscPrelId parIdKey gHC__ SLIT("par")
+parId = pcMiscPrelId parIdKey cONC_BASE SLIT("par")
                  (mkSigmaTy [alphaTyVar, betaTyVar] []
                    (mkFunTys [alphaTy, betaTy] betaTy))
                  (mkSigmaTy [alphaTyVar, betaTyVar] []
                    (mkFunTys [alphaTy, betaTy] betaTy))
-                 (noIdInfo `addInfo_UF` (mkUnfolding EssentialUnfolding par_template))
+                 (noIdInfo `addUnfoldInfo` (mkUnfolding True par_template))
   where
     [x, y, z]
       = mkTemplateLocals [
   where
     [x, y, z]
       = mkTemplateLocals [
@@ -273,10 +266,10 @@ parId = pcMiscPrelId parIdKey gHC__ SLIT("par")
 {-
    _fork_ = /\ a b -> \ x::a y::b -> case fork# x of { 0# -> parError#; _ -> y; }
 -}
 {-
    _fork_ = /\ a b -> \ x::a y::b -> case fork# x of { 0# -> parError#; _ -> y; }
 -}
-forkId = pcMiscPrelId forkIdKey gHC__ SLIT("fork")
+forkId = pcMiscPrelId forkIdKey cONC_BASE SLIT("fork")
                  (mkSigmaTy [alphaTyVar, betaTyVar] []
                    (mkFunTys [alphaTy, betaTy] betaTy))
                  (mkSigmaTy [alphaTyVar, betaTyVar] []
                    (mkFunTys [alphaTy, betaTy] betaTy))
-                 (noIdInfo `addInfo_UF` (mkUnfolding EssentialUnfolding fork_template))
+                 (noIdInfo `addUnfoldInfo` (mkUnfolding True fork_template))
   where
     [x, y, z]
       = mkTemplateLocals [
   where
     [x, y, z]
       = mkTemplateLocals [
@@ -291,15 +284,16 @@ forkId = pcMiscPrelId forkIdKey gHC__ SLIT("fork")
                  PrimAlts
                    [(mkMachInt 0, mkTyApp (Var pAR_ERROR_ID) [betaTy])]
                    (BindDefault z (Var y))))
                  PrimAlts
                    [(mkMachInt 0, mkTyApp (Var pAR_ERROR_ID) [betaTy])]
                    (BindDefault z (Var y))))
-
+-}
 \end{code}
 
 GranSim ones:
 \begin{code}
 \end{code}
 
 GranSim ones:
 \begin{code}
-parLocalId = pcMiscPrelId parLocalIdKey gHC__ SLIT("parLocal")
+{- OUT:
+parLocalId = pcMiscPrelId parLocalIdKey cONC_BASE SLIT("parLocal")
                  (mkSigmaTy [alphaTyVar, betaTyVar] []
                    (mkFunTys [intPrimTy, intPrimTy, intPrimTy, intPrimTy, alphaTy, betaTy] betaTy))
                  (mkSigmaTy [alphaTyVar, betaTyVar] []
                    (mkFunTys [intPrimTy, intPrimTy, intPrimTy, intPrimTy, alphaTy, betaTy] betaTy))
-                 (noIdInfo `addInfo_UF` (mkUnfolding EssentialUnfolding parLocal_template))
+                 (noIdInfo `addUnfoldInfo` (mkUnfolding True parLocal_template))
   where
     -- Annotations: w: name, g: gran. info, s: size info, p: par info  -- HWL
     [w, g, s, p, x, y, z]
   where
     -- Annotations: w: name, g: gran. info, s: size info, p: par info  -- HWL
     [w, g, s, p, x, y, z]
@@ -320,10 +314,10 @@ parLocalId = pcMiscPrelId parLocalIdKey gHC__ SLIT("parLocal")
                    [(mkMachInt 0, mkTyApp (Var pAR_ERROR_ID) [betaTy])]
                    (BindDefault z (Var y))))
 
                    [(mkMachInt 0, mkTyApp (Var pAR_ERROR_ID) [betaTy])]
                    (BindDefault z (Var y))))
 
-parGlobalId = pcMiscPrelId parGlobalIdKey gHC__ SLIT("parGlobal")
+parGlobalId = pcMiscPrelId parGlobalIdKey cONC_BASE SLIT("parGlobal")
                  (mkSigmaTy [alphaTyVar, betaTyVar] []
                    (mkFunTys [intPrimTy, intPrimTy, intPrimTy, intPrimTy, alphaTy, betaTy] betaTy))
                  (mkSigmaTy [alphaTyVar, betaTyVar] []
                    (mkFunTys [intPrimTy, intPrimTy, intPrimTy, intPrimTy, alphaTy, betaTy] betaTy))
-                 (noIdInfo `addInfo_UF` (mkUnfolding EssentialUnfolding parGlobal_template))
+                 (noIdInfo `addUnfoldInfo` (mkUnfolding True parGlobal_template))
   where
     -- Annotations: w: name, g: gran. info, s: size info, p: par info  -- HWL
     [w, g, s, p, x, y, z]
   where
     -- Annotations: w: name, g: gran. info, s: size info, p: par info  -- HWL
     [w, g, s, p, x, y, z]
@@ -345,11 +339,11 @@ parGlobalId = pcMiscPrelId parGlobalIdKey gHC__ SLIT("parGlobal")
                    (BindDefault z (Var y))))
 
 
                    (BindDefault z (Var y))))
 
 
-parAtId = pcMiscPrelId parAtIdKey gHC__ SLIT("parAt")
+parAtId = pcMiscPrelId parAtIdKey cONC_BASE SLIT("parAt")
                  (mkSigmaTy [alphaTyVar, betaTyVar] []
                    (mkFunTys [intPrimTy, intPrimTy, intPrimTy, intPrimTy,
                               alphaTy, betaTy, gammaTy] gammaTy))
                  (mkSigmaTy [alphaTyVar, betaTyVar] []
                    (mkFunTys [intPrimTy, intPrimTy, intPrimTy, intPrimTy,
                               alphaTy, betaTy, gammaTy] gammaTy))
-                 (noIdInfo `addInfo_UF` (mkUnfolding EssentialUnfolding parAt_template))
+                 (noIdInfo `addUnfoldInfo` (mkUnfolding True parAt_template))
   where
     -- Annotations: w: name, g: gran. info, s: size info, p: par info  -- HWL
     [w, g, s, p, v, x, y, z]
   where
     -- Annotations: w: name, g: gran. info, s: size info, p: par info  -- HWL
     [w, g, s, p, v, x, y, z]
@@ -368,13 +362,13 @@ parAtId = pcMiscPrelId parAtIdKey gHC__ SLIT("parAt")
       = mkLam [alphaTyVar, betaTyVar, gammaTyVar] [w, g, s, p, v, x, y] (
                Case (Prim ParAtOp [TyArg alphaTy, TyArg betaTy, TyArg gammaTy, VarArg x, VarArg v, VarArg w, VarArg g, VarArg s, VarArg p, VarArg y]) (
                  PrimAlts
       = mkLam [alphaTyVar, betaTyVar, gammaTyVar] [w, g, s, p, v, x, y] (
                Case (Prim ParAtOp [TyArg alphaTy, TyArg betaTy, TyArg gammaTy, VarArg x, VarArg v, VarArg w, VarArg g, VarArg s, VarArg p, VarArg y]) (
                  PrimAlts
-                   [(mkMachInt 0, mkTyApp (Var pAR_ERROR_ID) [betaTy])]
+                   [(mkMachInt 0, mkTyApp (Var pAR_ERROR_ID) [gammaTy])]
                    (BindDefault z (Var y))))
 
                    (BindDefault z (Var y))))
 
-parAtAbsId = pcMiscPrelId parAtAbsIdKey gHC__ SLIT("parAtAbs")
+parAtAbsId = pcMiscPrelId parAtAbsIdKey cONC_BASE SLIT("parAtAbs")
                  (mkSigmaTy [alphaTyVar, betaTyVar] []
                    (mkFunTys [intPrimTy, intPrimTy, intPrimTy, intPrimTy, intPrimTy, alphaTy, betaTy] betaTy))
                  (mkSigmaTy [alphaTyVar, betaTyVar] []
                    (mkFunTys [intPrimTy, intPrimTy, intPrimTy, intPrimTy, intPrimTy, alphaTy, betaTy] betaTy))
-                 (noIdInfo `addInfo_UF` (mkUnfolding EssentialUnfolding parAtAbs_template))
+                 (noIdInfo `addUnfoldInfo` (mkUnfolding True parAtAbs_template))
   where
     -- Annotations: w: name, g: gran. info, s: size info, p: par info  -- HWL
     [w, g, s, p, v, x, y, z]
   where
     -- Annotations: w: name, g: gran. info, s: size info, p: par info  -- HWL
     [w, g, s, p, v, x, y, z]
@@ -396,10 +390,10 @@ parAtAbsId = pcMiscPrelId parAtAbsIdKey gHC__ SLIT("parAtAbs")
                    [(mkMachInt 0, mkTyApp (Var pAR_ERROR_ID) [betaTy])]
                    (BindDefault z (Var y))))
 
                    [(mkMachInt 0, mkTyApp (Var pAR_ERROR_ID) [betaTy])]
                    (BindDefault z (Var y))))
 
-parAtRelId = pcMiscPrelId parAtRelIdKey gHC__ SLIT("parAtRel")
+parAtRelId = pcMiscPrelId parAtRelIdKey cONC_BASE SLIT("parAtRel")
                  (mkSigmaTy [alphaTyVar, betaTyVar] []
                    (mkFunTys [intPrimTy, intPrimTy, intPrimTy, intPrimTy, intPrimTy, alphaTy, betaTy] betaTy))
                  (mkSigmaTy [alphaTyVar, betaTyVar] []
                    (mkFunTys [intPrimTy, intPrimTy, intPrimTy, intPrimTy, intPrimTy, alphaTy, betaTy] betaTy))
-                 (noIdInfo `addInfo_UF` (mkUnfolding EssentialUnfolding parAtRel_template))
+                 (noIdInfo `addUnfoldInfo` (mkUnfolding True parAtRel_template))
   where
     -- Annotations: w: name, g: gran. info, s: size info, p: par info  -- HWL
     [w, g, s, p, v, x, y, z]
   where
     -- Annotations: w: name, g: gran. info, s: size info, p: par info  -- HWL
     [w, g, s, p, v, x, y, z]
@@ -421,11 +415,11 @@ parAtRelId = pcMiscPrelId parAtRelIdKey gHC__ SLIT("parAtRel")
                    [(mkMachInt 0, mkTyApp (Var pAR_ERROR_ID) [betaTy])]
                    (BindDefault z (Var y))))
 
                    [(mkMachInt 0, mkTyApp (Var pAR_ERROR_ID) [betaTy])]
                    (BindDefault z (Var y))))
 
-parAtForNowId = pcMiscPrelId parAtForNowIdKey gHC__ SLIT("parAtForNow")
+parAtForNowId = pcMiscPrelId parAtForNowIdKey cONC_BASE SLIT("parAtForNow")
                  (mkSigmaTy [alphaTyVar, betaTyVar] []
                    (mkFunTys [intPrimTy, intPrimTy, intPrimTy, intPrimTy,
                                alphaTy, betaTy, gammaTy] gammaTy))
                  (mkSigmaTy [alphaTyVar, betaTyVar] []
                    (mkFunTys [intPrimTy, intPrimTy, intPrimTy, intPrimTy,
                                alphaTy, betaTy, gammaTy] gammaTy))
-                 (noIdInfo `addInfo_UF` (mkUnfolding EssentialUnfolding parAtForNow_template))
+                 (noIdInfo `addUnfoldInfo` (mkUnfolding True parAtForNow_template))
   where
     -- Annotations: w: name, g: gran. info, s: size info, p: par info  -- HWL
     [w, g, s, p, v, x, y, z]
   where
     -- Annotations: w: name, g: gran. info, s: size info, p: par info  -- HWL
     [w, g, s, p, v, x, y, z]
@@ -444,16 +438,16 @@ parAtForNowId = pcMiscPrelId parAtForNowIdKey gHC__ SLIT("parAtForNow")
       = mkLam [alphaTyVar, betaTyVar, gammaTyVar] [w, g, s, p, v, x, y] (
                Case (Prim ParAtForNowOp [TyArg alphaTy, TyArg betaTy, TyArg gammaTy, VarArg x, VarArg v, VarArg w, VarArg g, VarArg s, VarArg p, VarArg y]) (
                  PrimAlts
       = mkLam [alphaTyVar, betaTyVar, gammaTyVar] [w, g, s, p, v, x, y] (
                Case (Prim ParAtForNowOp [TyArg alphaTy, TyArg betaTy, TyArg gammaTy, VarArg x, VarArg v, VarArg w, VarArg g, VarArg s, VarArg p, VarArg y]) (
                  PrimAlts
-                   [(mkMachInt 0, mkTyApp (Var pAR_ERROR_ID) [betaTy])]
+                   [(mkMachInt 0, mkTyApp (Var pAR_ERROR_ID) [gammaTy])]
                    (BindDefault z (Var y))))
 
 -- copyable and noFollow are currently merely hooks: they are translated into
 -- calls to the macros COPYABLE and NOFOLLOW                            -- HWL 
 
                    (BindDefault z (Var y))))
 
 -- copyable and noFollow are currently merely hooks: they are translated into
 -- calls to the macros COPYABLE and NOFOLLOW                            -- HWL 
 
-copyableId = pcMiscPrelId copyableIdKey gHC__ SLIT("copyable")
+copyableId = pcMiscPrelId copyableIdKey cONC_BASE SLIT("copyable")
                  (mkSigmaTy [alphaTyVar] []
                    alphaTy)
                  (mkSigmaTy [alphaTyVar] []
                    alphaTy)
-                 (noIdInfo `addInfo_UF` (mkUnfolding EssentialUnfolding copyable_template))
+                 (noIdInfo `addUnfoldInfo` (mkUnfolding True copyable_template))
   where
     -- Annotations: x: closure that's tagged to by copyable
     [x, z]
   where
     -- Annotations: x: closure that's tagged to by copyable
     [x, z]
@@ -465,10 +459,10 @@ copyableId = pcMiscPrelId copyableIdKey gHC__ SLIT("copyable")
     copyable_template
       = mkLam [alphaTyVar] [x] ( Prim CopyableOp [TyArg alphaTy, VarArg x] )
 
     copyable_template
       = mkLam [alphaTyVar] [x] ( Prim CopyableOp [TyArg alphaTy, VarArg x] )
 
-noFollowId = pcMiscPrelId noFollowIdKey gHC__ SLIT("noFollow")
+noFollowId = pcMiscPrelId noFollowIdKey cONC_BASE SLIT("noFollow")
                  (mkSigmaTy [alphaTyVar] []
                    alphaTy)
                  (mkSigmaTy [alphaTyVar] []
                    alphaTy)
-                 (noIdInfo `addInfo_UF` (mkUnfolding EssentialUnfolding noFollow_template))
+                 (noIdInfo `addUnfoldInfo` (mkUnfolding True noFollow_template))
   where
     -- Annotations: x: closure that's tagged to not follow
     [x, z]
   where
     -- Annotations: x: closure that's tagged to not follow
     [x, z]
@@ -479,45 +473,29 @@ noFollowId = pcMiscPrelId noFollowIdKey gHC__ SLIT("noFollow")
 
     noFollow_template
       = mkLam [alphaTyVar] [x] ( Prim NoFollowOp [TyArg alphaTy, VarArg x] )
 
     noFollow_template
       = mkLam [alphaTyVar] [x] ( Prim NoFollowOp [TyArg alphaTy, VarArg x] )
+-}
 \end{code}
 
 %************************************************************************
 %*                                                                     *
 \end{code}
 
 %************************************************************************
 %*                                                                     *
-\subsection[PrelVals-deriving]{Values known about mainly for doing derived instance decls}
+\subsection[PrelVals-runST]{@runST@: Magic start-state-transformer function}
 %*                                                                     *
 %************************************************************************
 
 %*                                                                     *
 %************************************************************************
 
-map            :: (a -> b) -> [a] -> [b]
-       -- this is up in the here-because-of-unfolding list
-
---??showChar   :: Char -> ShowS
-showSpace      :: ShowS        -- non-std: == "showChar ' '"
-showString     :: String -> ShowS
-showParen      :: Bool -> ShowS -> ShowS
-
-(++)           :: [a] -> [a] -> [a]
-readParen      :: Bool -> ReadS a -> ReadS a
-lex            :: ReadS String
-
-%************************************************************************
-%*                                                                     *
-\subsection[PrelVals-runST]{@_runST@: Magic start-state-transformer function}
-%*                                                                     *
-%************************************************************************
-
-@_runST@ has a non-Haskell-able type:
+@runST@ has a non-Haskell-able type:
 \begin{verbatim}
 \begin{verbatim}
--- _runST :: forall a. (forall s. _ST s a) -> a
+-- runST :: forall a. (forall s. _ST s a) -> a
 -- which is to say ::
 --          forall a. (forall s. (_State s -> (a, _State s))) -> a
 
 -- which is to say ::
 --          forall a. (forall s. (_State s -> (a, _State s))) -> a
 
-_runST a m = case m _RealWorld (S# _RealWorld realWorld#) of
+runST a m = case m _RealWorld (S# _RealWorld realWorld#) of
               (r :: a, wild :: _State _RealWorld) -> r
 \end{verbatim}
               (r :: a, wild :: _State _RealWorld) -> r
 \end{verbatim}
+
 We unfold always, just for simplicity:
 \begin{code}
 runSTId
 We unfold always, just for simplicity:
 \begin{code}
 runSTId
-  = pcMiscPrelId runSTIdKey gHC__ SLIT("runST") run_ST_ty id_info
+  = pcMiscPrelId runSTIdKey sT_BASE SLIT("runST") run_ST_ty id_info
   where
     s_tv = betaTyVar
     s   = betaTy
   where
     s_tv = betaTyVar
     s   = betaTy
@@ -530,10 +508,10 @@ runSTId
 
     id_info
       = noIdInfo
 
     id_info
       = noIdInfo
-       `addInfo` mkArityInfo 1
-       `addInfo` mkStrictnessInfo [WwStrict] Nothing
-       `addInfo` mkArgUsageInfo [ArgUsage 1]
-       -- ABSOLUTELY NO UNFOLDING, e.g.: (mkUnfolding EssentialUnfolding run_ST_template)
+       `addArityInfo` exactArity 1
+       `addStrictnessInfo` mkStrictnessInfo [WwStrict] Nothing
+       `addArgUsageInfo` mkArgUsageInfo [ArgUsage 1]
+       -- ABSOLUTELY NO UNFOLDING, e.g.: (mkUnfolding True run_ST_template)
        -- see example below
 {- OUT:
     [m, t, r, wild]
        -- see example below
 {- OUT:
     [m, t, r, wild]
@@ -549,21 +527,21 @@ runSTId
            Let (NonRec t (Con stateDataCon [TyArg realWorldTy, VarArg realWorldPrimId])) (
              Case (App (mkTyApp (Var m) [realWorldTy]) (VarArg t)) (
                AlgAlts
            Let (NonRec t (Con stateDataCon [TyArg realWorldTy, VarArg realWorldPrimId])) (
              Case (App (mkTyApp (Var m) [realWorldTy]) (VarArg t)) (
                AlgAlts
-                 [(mkTupleCon 2, [r, wild], Var r)]
+                 [(pairDataCon, [r, wild], Var r)]
                  NoDefault)))
 -}
 \end{code}
 
                  NoDefault)))
 -}
 \end{code}
 
-SLPJ 95/04: Why @_runST@ must not have an unfolding; consider:
+SLPJ 95/04: Why @runST@ must not have an unfolding; consider:
 \begin{verbatim}
 f x =
 \begin{verbatim}
 f x =
-  _runST ( \ s -> let
+  runST ( \ s -> let
                    (a, s')  = newArray# 100 [] s
                    (_, s'') = fill_in_array_or_something a x s'
                  in
                  freezeArray# a s'' )
 \end{verbatim}
                    (a, s')  = newArray# 100 [] s
                    (_, s'') = fill_in_array_or_something a x s'
                  in
                  freezeArray# a s'' )
 \end{verbatim}
-If we inline @_runST@, we'll get:
+If we inline @runST@, we'll get:
 \begin{verbatim}
 f x = let
        (a, s')  = newArray# 100 [] realWorld#{-NB-}
 \begin{verbatim}
 f x = let
        (a, s')  = newArray# 100 [] realWorld#{-NB-}
@@ -587,13 +565,13 @@ All calls to @f@ will share a {\em single} array!  End SLPJ 95/04.
 nasty as-is, change it back to a literal (@Literal@).
 \begin{code}
 realWorldPrimId
 nasty as-is, change it back to a literal (@Literal@).
 \begin{code}
 realWorldPrimId
-  = pcMiscPrelId realWorldPrimIdKey gHC_BUILTINS SLIT("realWorld#")
+  = pcMiscPrelId realWorldPrimIdKey gHC__ SLIT("realWorld#")
        realWorldStatePrimTy
        noIdInfo
 \end{code}
 
 \begin{code}
        realWorldStatePrimTy
        noIdInfo
 \end{code}
 
 \begin{code}
-voidId = pcMiscPrelId voidIdKey gHC_BUILTINS SLIT("void") voidTy noIdInfo
+voidId = pc_bottoming_Id voidIdKey pREL_BASE SLIT("void") voidTy
 \end{code}
 
 %************************************************************************
 \end{code}
 
 %************************************************************************
@@ -604,12 +582,12 @@ voidId = pcMiscPrelId voidIdKey gHC_BUILTINS SLIT("void") voidTy noIdInfo
 
 \begin{code}
 buildId
 
 \begin{code}
 buildId
-  = pcMiscPrelId buildIdKey gHC__ SLIT("build") buildTy
+  = pcMiscPrelId buildIdKey gHC_ERR SLIT("build") buildTy
        ((((noIdInfo
        ((((noIdInfo
-               {-LATER:`addInfo_UF` mkMagicUnfolding buildIdKey-})
-               `addInfo` mkStrictnessInfo [WwStrict] Nothing)
-               `addInfo` mkArgUsageInfo [ArgUsage 2])
-               `addInfo` pcGenerateSpecs buildIdKey buildId noIdInfo{-ToDo-} buildTy)
+               {-LATER:`addUnfoldInfo` mkMagicUnfolding buildIdKey-})
+               `addStrictnessInfo` mkStrictnessInfo [WwStrict] Nothing)
+               `addArgUsageInfo` mkArgUsageInfo [ArgUsage 2])
+               `addSpecInfo` pcGenerateSpecs buildIdKey buildId noIdInfo{-ToDo-} buildTy)
        -- cheating, but since _build never actually exists ...
   where
     -- The type of this strange object is:
        -- cheating, but since _build never actually exists ...
   where
     -- The type of this strange object is:
@@ -649,11 +627,11 @@ mkBuild ty tv c n g expr
 
 \begin{code}
 augmentId
 
 \begin{code}
 augmentId
-  = pcMiscPrelId augmentIdKey gHC__ SLIT("augment") augmentTy
+  = pcMiscPrelId augmentIdKey gHC_ERR SLIT("augment") augmentTy
        (((noIdInfo
        (((noIdInfo
-               {-LATER:`addInfo_UF` mkMagicUnfolding augmentIdKey-})
-               `addInfo` mkStrictnessInfo [WwStrict,WwLazy False] Nothing)
-               `addInfo` mkArgUsageInfo [ArgUsage 2,UnknownArgUsage])
+               {-LATER:`addUnfoldInfo` mkMagicUnfolding augmentIdKey-})
+               `addStrictnessInfo` mkStrictnessInfo [WwStrict,WwLazy False] Nothing)
+               `addArgUsageInfo` mkArgUsageInfo [ArgUsage 2,UnknownArgUsage])
        -- cheating, but since _augment never actually exists ...
   where
     -- The type of this strange object is:
        -- cheating, but since _augment never actually exists ...
   where
     -- The type of this strange object is:
@@ -666,7 +644,7 @@ augmentId
 \end{code}
 
 \begin{code}
 \end{code}
 
 \begin{code}
-foldrId = pcMiscPrelId foldrIdKey pRELUDE SLIT("foldr")
+foldrId = pcMiscPrelId foldrIdKey pREL_BASE SLIT("foldr")
                 foldrTy idInfo
   where
        foldrTy =
                 foldrTy idInfo
   where
        foldrTy =
@@ -674,13 +652,13 @@ foldrId = pcMiscPrelId foldrIdKey pRELUDE SLIT("foldr")
                (mkFunTys [mkFunTys [alphaTy, betaTy] betaTy, betaTy, mkListTy alphaTy] betaTy)
 
        idInfo = (((((noIdInfo
                (mkFunTys [mkFunTys [alphaTy, betaTy] betaTy, betaTy, mkListTy alphaTy] betaTy)
 
        idInfo = (((((noIdInfo
-                       {-LATER:`addInfo_UF` mkMagicUnfolding foldrIdKey-})
-                       `addInfo` mkStrictnessInfo [WwLazy False,WwLazy False,WwStrict] Nothing)
-                       `addInfo` mkArityInfo 3)
-                       `addInfo` mkUpdateInfo [2,2,1])
-                       `addInfo` pcGenerateSpecs foldrIdKey foldrId noIdInfo{-ToDo-} foldrTy)
+                       {-LATER:`addUnfoldInfo` mkMagicUnfolding foldrIdKey-})
+                       `addStrictnessInfo` mkStrictnessInfo [WwLazy False,WwLazy False,WwStrict] Nothing)
+                       `addArityInfo` exactArity 3)
+                       `addUpdateInfo` mkUpdateInfo [2,2,1])
+                       `addSpecInfo` pcGenerateSpecs foldrIdKey foldrId noIdInfo{-ToDo-} foldrTy)
 
 
-foldlId = pcMiscPrelId foldlIdKey pRELUDE SLIT("foldl")
+foldlId = pcMiscPrelId foldlIdKey pREL_LIST SLIT("foldl")
                 foldlTy idInfo
   where
        foldlTy =
                 foldlTy idInfo
   where
        foldlTy =
@@ -688,11 +666,11 @@ foldlId = pcMiscPrelId foldlIdKey pRELUDE SLIT("foldl")
                (mkFunTys [mkFunTys [alphaTy, betaTy] alphaTy, alphaTy, mkListTy betaTy] alphaTy)
 
        idInfo = (((((noIdInfo
                (mkFunTys [mkFunTys [alphaTy, betaTy] alphaTy, alphaTy, mkListTy betaTy] alphaTy)
 
        idInfo = (((((noIdInfo
-                       {-LATER:`addInfo_UF` mkMagicUnfolding foldlIdKey-})
-                       `addInfo` mkStrictnessInfo [WwLazy False,WwLazy False,WwStrict] Nothing)
-                       `addInfo` mkArityInfo 3)
-                       `addInfo` mkUpdateInfo [2,2,1])
-                       `addInfo` pcGenerateSpecs foldlIdKey foldlId noIdInfo{-ToDo-} foldlTy)
+                       {-LATER:`addUnfoldInfo` mkMagicUnfolding foldlIdKey-})
+                       `addStrictnessInfo` mkStrictnessInfo [WwLazy False,WwLazy False,WwStrict] Nothing)
+                       `addArityInfo` exactArity 3)
+                       `addUpdateInfo` mkUpdateInfo [2,2,1])
+                       `addSpecInfo` pcGenerateSpecs foldlIdKey foldlId noIdInfo{-ToDo-} foldlTy)
 
 -- A bit of magic goes no here. We translate appendId into ++,
 -- you have to be carefull when you actually compile append:
 
 -- A bit of magic goes no here. We translate appendId into ++,
 -- you have to be carefull when you actually compile append:
@@ -709,15 +687,15 @@ foldlId = pcMiscPrelId foldlIdKey pRELUDE SLIT("foldl")
 --
 {- OLD: doesn't apply with 1.3
 appendId
 --
 {- OLD: doesn't apply with 1.3
 appendId
-  = pcMiscPrelId appendIdKey pRELUDE_LIST SLIT("++") appendTy idInfo
+  = pcMiscPrelId appendIdKey mONAD SLIT("++") appendTy idInfo
   where
     appendTy =
       (mkSigmaTy [alphaTyVar] []
            (mkFunTys [mkListTy alphaTy, mkListTy alphaTy] (mkListTy alphaTy)))
     idInfo = (((noIdInfo
   where
     appendTy =
       (mkSigmaTy [alphaTyVar] []
            (mkFunTys [mkListTy alphaTy, mkListTy alphaTy] (mkListTy alphaTy)))
     idInfo = (((noIdInfo
-               `addInfo` mkStrictnessInfo [WwStrict,WwLazy False] Nothing)
-               `addInfo` mkArityInfo 2)
-               `addInfo` mkUpdateInfo [1,2])
+               `addStrictnessInfo` mkStrictnessInfo [WwStrict,WwLazy False] Nothing)
+               `addArityInfo` exactArity 2)
+               `addUpdateInfo` mkUpdateInfo [1,2])
 -}
 \end{code}
 
 -}
 \end{code}