Commit da162afc authored by simonpj's avatar simonpj
Browse files

[project @ 2000-10-31 17:30:16 by simonpj]

PrelBase compiles!
parent 12467fbf
......@@ -251,9 +251,12 @@ hasNoBinding id = case idFlavour id of
-- Don't drop a binding for an exported Id,
-- if it otherwise looks dead.
isExportedId :: Id -> Bool
isExportedId id = case idFlavour id of
isExportedId id = isUserExportedId id -- Try this
{-
case idFlavour id of
VanillaId -> False
other -> True -- All the others are no-discard
-}
-- Say if an Id was exported by the user
-- Implies isExportedId (see mkId above)
......
......@@ -45,7 +45,7 @@ module Name (
import OccName -- All of it
import Module ( Module, moduleName, mkVanillaModule,
printModulePrefix, isModuleInThisPackage )
import RdrName ( RdrName, mkRdrQual, mkRdrUnqual, rdrNameOcc, rdrNameModule )
import RdrName ( RdrName, mkRdrOrig, mkRdrIfaceUnqual, rdrNameOcc, rdrNameModule )
import CmdLineOpts ( opt_Static, opt_OmitInterfacePragmas, opt_EnsureSplittableC )
import SrcLoc ( builtinSrcLoc, noSrcLoc, SrcLoc )
import Unique ( Unique, Uniquable(..), u2i, pprUnique, pprUnique10 )
......@@ -301,7 +301,7 @@ tidyTopName mod env
System -> localise -- System local Ids
Local -> localise -- User non-exported Ids
Exported -> globalise -- User-exported things
Global _ -> no_op -- Constructors, class selectors etc
Global _ -> no_op -- Constructors, class selectors, default methods
where
no_op = (env, name)
......@@ -354,14 +354,8 @@ hashName name = iBox (u2i (nameUnique name))
nameRdrName :: Name -> RdrName
-- Makes a qualified name for top-level (Global) names, whether locally defined or not
-- and an unqualified name just for Locals
nameRdrName (Name { n_occ = occ, n_sort = Global mod }) = mkRdrQual (moduleName mod) occ
nameRdrName (Name { n_occ = occ }) = mkRdrUnqual occ
ifaceNameRdrName :: Name -> RdrName
-- Makes a qualified naem for imported things,
-- and an unqualified one for local things
ifaceNameRdrName n | isLocallyDefined n = mkRdrUnqual (nameOccName n)
| otherwise = mkRdrQual (moduleName (nameModule n)) (nameOccName n)
nameRdrName (Name { n_occ = occ, n_sort = Global mod }) = mkRdrOrig (moduleName mod) occ
nameRdrName (Name { n_occ = occ }) = mkRdrIfaceUnqual occ
isDllName :: Name -> Bool
-- Does this name refer to something in a different DLL?
......@@ -477,15 +471,32 @@ pprLocal sty uniq occ pp_export
| otherwise = pprOccName occ
pprGlobal sty uniq mod occ
| codeStyle sty = ppr (moduleName mod) <> char '_' <> pprOccName occ
| codeStyle sty
|| ifaceStyle sty = ppr (moduleName mod) <> char '_' <> pprOccName occ
| debugStyle sty = ppr (moduleName mod) <> dot <> pprOccName occ <>
text "{-" <> pprUnique10 uniq <> text "-}"
| printModulePrefix mod = ppr (moduleName mod) <> dot <> pprOccName occ
| otherwise = pprOccName occ
pprSysLocal sty uniq occ
| codeStyle sty = pprUnique uniq
| otherwise = pprOccName occ <> char '_' <> pprUnique uniq
{-
pprNameBndr :: Name -> SDoc
-- Print a binding occurrence of a name.
-- In interface files we can omit the "M." prefix, which tides things up a lot
pprNameBndr name
= getPprStyle $ \ sty ->
case sort of
Global mod | ifaceStyle sty -> pprLocal sty uniq occ empty
| otherwise -> pprGlobal sty uniq mod occ
System -> pprSysLocal sty uniq occ
Local -> pprLocal sty uniq occ empty
Exported -> pprLocal sty uniq occ (char 'x')
-}
\end{code}
......@@ -514,7 +525,7 @@ isLocalOrFrom :: NamedThing a => Module -> a -> Bool
getSrcLoc = nameSrcLoc . getName
isLocallyDefined = nameIsLocallyDefined . getName
getOccString = occNameString . getOccName
toRdrName = ifaceNameRdrName . getName
toRdrName = nameRdrName . getName
isFrom mod x = nameIsFrom mod (getName x)
isLocalOrFrom mod x = nameIsLocalOrFrom mod ( getName x)
\end{code}
......
......@@ -9,15 +9,14 @@ module RdrName (
RdrName,
-- Construction
mkRdrUnqual, mkRdrQual,
mkUnqual, mkQual,
mkSysUnqual, mkSysQual,
mkPreludeQual, qualifyRdrName, mkRdrNameWkr,
mkRdrUnqual, mkRdrQual, mkRdrOrig, mkRdrIfaceUnqual,
mkUnqual, mkQual, mkIfaceOrig, mkOrig,
qualifyRdrName, mkRdrNameWkr,
dummyRdrVarName, dummyRdrTcName,
-- Destruction
rdrNameModule, rdrNameOcc, setRdrNameOcc,
isRdrDataCon, isRdrTyVar, isQual, isUnqual,
isRdrDataCon, isRdrTyVar, isQual, isSourceQual, isUnqual, isIface,
-- Environment
RdrNameEnv,
......@@ -31,7 +30,7 @@ module RdrName (
#include "HsVersions.h"
import OccName ( NameSpace, tcName,
OccName, UserFS,
OccName, UserFS, EncodedFS,
mkSysOccFS,
mkOccFS, mkVarOcc,
isDataOcc, isTvOcc, mkWorkerOcc
......@@ -55,7 +54,18 @@ import Util ( thenCmp )
data RdrName = RdrName Qual OccName
data Qual = Unqual
| Qual ModuleName -- The (encoded) module name
| IfaceUnqual -- An unqualified name from an interface file;
-- implicitly its module is that of the enclosing
-- interface file; don't look it up in the environment
| Qual ModuleName -- A qualified name written by the user in source code
-- The module isn't necessarily the module where
-- the thing is defined; just the one from which it
-- is imported
| Orig ModuleName -- This is an *original* name; the module is the place
-- where the thing was defined
\end{code}
......@@ -68,6 +78,7 @@ data Qual = Unqual
\begin{code}
rdrNameModule :: RdrName -> ModuleName
rdrNameModule (RdrName (Qual m) _) = m
rdrNameModule (RdrName (Orig m) _) = m
rdrNameOcc :: RdrName -> OccName
rdrNameOcc (RdrName _ occ) = occ
......@@ -81,9 +92,19 @@ setRdrNameOcc (RdrName q _) occ = RdrName q occ
mkRdrUnqual :: OccName -> RdrName
mkRdrUnqual occ = RdrName Unqual occ
mkRdrIfaceUnqual :: OccName -> RdrName
mkRdrIfaceUnqual occ = RdrName IfaceUnqual occ
mkRdrQual :: ModuleName -> OccName -> RdrName
mkRdrQual mod occ = RdrName (Qual mod) occ
mkRdrOrig :: ModuleName -> OccName -> RdrName
mkRdrOrig mod occ = RdrName (Orig mod) occ
mkIfaceOrig :: NameSpace -> (EncodedFS, EncodedFS) -> RdrName
mkIfaceOrig ns (m,n) = RdrName (Orig (mkSysModuleNameFS m)) (mkSysOccFS ns n)
-- These two are used when parsing source files
-- They do encode the module and occurrence names
mkUnqual :: NameSpace -> FAST_STRING -> RdrName
......@@ -92,16 +113,8 @@ mkUnqual sp n = RdrName Unqual (mkOccFS sp n)
mkQual :: NameSpace -> (UserFS, UserFS) -> RdrName
mkQual sp (m, n) = RdrName (Qual (mkModuleNameFS m)) (mkOccFS sp n)
-- These two are used when parsing interface files
-- They do not encode the module and occurrence name
mkSysUnqual :: NameSpace -> FAST_STRING -> RdrName
mkSysUnqual sp n = RdrName Unqual (mkSysOccFS sp n)
mkSysQual :: NameSpace -> (FAST_STRING, FAST_STRING) -> RdrName
mkSysQual sp (m,n) = RdrName (Qual (mkSysModuleNameFS m)) (mkSysOccFS sp n)
mkPreludeQual :: NameSpace -> ModuleName -> FAST_STRING -> RdrName
mkPreludeQual sp mod n = RdrName (Qual mod) (mkOccFS sp n)
mkOrig :: NameSpace -> ModuleName -> UserFS -> RdrName
mkOrig sp mod n = RdrName (Orig mod) (mkOccFS sp n)
qualifyRdrName :: ModuleName -> RdrName -> RdrName
-- Sets the module name of a RdrName, even if it has one already
......@@ -126,10 +139,18 @@ dummyRdrTcName = RdrName Unqual (mkOccFS tcName SLIT("TC-DUMMY"))
isRdrDataCon (RdrName _ occ) = isDataOcc occ
isRdrTyVar (RdrName _ occ) = isTvOcc occ
isUnqual (RdrName Unqual _) = True
isUnqual other = False
isUnqual (RdrName Unqual _) = True
isUnqual (RdrName IfaceUnqual _) = True
isUnqual other = False
isQual rdr_name = not (isUnqual rdr_name)
isSourceQual (RdrName (Qual _) _) = True
isSourceQual _ = False
isIface (RdrName (Orig _) _) = True
isIface (RdrName IfaceUnqual _) = True
isIface other = False
\end{code}
......@@ -143,8 +164,10 @@ isQual rdr_name = not (isUnqual rdr_name)
instance Outputable RdrName where
ppr (RdrName qual occ) = pp_qual qual <> ppr occ
where
pp_qual Unqual = empty
pp_qual (Qual mod) = ppr mod <> dot
pp_qual Unqual = empty
pp_qual IfaceUnqual = empty
pp_qual (Qual mod) = ppr mod <> dot
pp_qual (Orig mod) = ppr mod <> dot
pprUnqualRdrName (RdrName qual occ) = ppr occ
......@@ -162,10 +185,15 @@ instance Ord RdrName where
= (o1 `compare` o2) `thenCmp`
(q1 `cmpQual` q2)
cmpQual Unqual Unqual = EQ
cmpQual Unqual (Qual _) = LT
cmpQual (Qual _) Unqual = GT
cmpQual (Qual m1) (Qual m2) = m1 `compare` m2
cmpQual Unqual Unqual = EQ
cmpQual IfaceUnqual IfaceUnqual = EQ
cmpQual (Qual m1) (Qual m2) = m1 `compare` m2
cmpQual (Orig m1) (Orig m2) = m1 `compare` m2
cmpQual Unqual _ = LT
cmpQual IfaceUnqual (Qual _) = LT
cmpQual IfaceUnqual (Orig _) = LT
cmpQual (Qual _) (Orig _) = LT
cmpQual _ _ = GT
\end{code}
......
......@@ -85,7 +85,6 @@ module CmdLineOpts (
opt_IgnoreAsserts,
opt_IgnoreIfacePragmas,
opt_NoHiCheck,
opt_NoImplicitPrelude,
opt_OmitBlackHoling,
opt_OmitInterfacePragmas,
opt_NoPruneTyDecls,
......@@ -273,6 +272,7 @@ data DynFlag
| Opt_AllowUndecidableInstances
| Opt_GlasgowExts
| Opt_Generics
| Opt_NoImplicitPrelude
-- misc
| Opt_ReportCompile
......@@ -422,7 +422,6 @@ opt_HistorySize = lookup_def_int "-fhistory-size" 20
opt_IgnoreAsserts = lookUp SLIT("-fignore-asserts")
opt_IgnoreIfacePragmas = lookUp SLIT("-fignore-interface-pragmas")
opt_NoHiCheck = lookUp SLIT("-fno-hi-version-check")
opt_NoImplicitPrelude = lookUp SLIT("-fno-implicit-prelude")
opt_OmitBlackHoling = lookUp SLIT("-dno-black-holing")
opt_OmitInterfacePragmas = lookUp SLIT("-fomit-interface-pragmas")
......@@ -472,7 +471,6 @@ isStaticHscFlag f =
"fticky-ticky",
"fall-strict",
"fdicts-strict",
"fgenerics",
"firrefutable-tuples",
"fnumbers-strict",
"fparallel",
......
-----------------------------------------------------------------------------
-- $Id: DriverFlags.hs,v 1.13 2000/10/27 15:11:37 sewardj Exp $
-- $Id: DriverFlags.hs,v 1.14 2000/10/31 17:30:17 simonpj Exp $
--
-- Driver flags
--
......@@ -392,6 +392,7 @@ dynamic_flags = [
------ Compiler flags -----------------------------------------------
, ( "fglasgow-exts", NoArg (setDynFlag Opt_GlasgowExts) )
, ( "fno-implicit-prelude", NoArg (setDynFlag Opt_NoImplicitPrelude) )
, ( "fallow-overlapping-instances",
NoArg (setDynFlag Opt_AllowOverlappingInstances) )
......
......@@ -31,13 +31,13 @@ module ParseUtil (
import Lex
import HsSyn -- Lots of it
import SrcLoc
import RdrHsSyn ( mkNPlusKPatIn, unitTyCon_RDR,
RdrBinding(..),
import RdrHsSyn ( RdrBinding(..),
RdrNameHsType, RdrNameBangType, RdrNameContext,
RdrNameHsTyVar, RdrNamePat, RdrNameHsExpr, RdrNameGRHSs,
RdrNameHsRecordBinds, RdrNameMonoBinds, RdrNameConDetails
)
import RdrName
import PrelNames ( unitTyCon_RDR, minus_RDR )
import CallConv
import OccName ( dataName, varName, tcClsName,
occNameSpace, setOccNameSpace, occNameUserString )
......@@ -202,7 +202,9 @@ checkPat e [] = case e of
OpApp (HsVar n) (HsVar plus) _ (HsOverLit lit@(HsIntegral k _))
| plus == plus_RDR
-> returnP (mkNPlusKPatIn n lit)
-> returnP (NPlusKPatIn n lit minus_RDR)
where
plus_RDR = mkUnqual varName SLIT("+") -- Hack
OpApp l op fix r -> checkPat l [] `thenP` \l ->
checkPat r [] `thenP` \r ->
......@@ -334,6 +336,4 @@ groupBindings binds = group Nothing binds
= case bind of
RdrValBinding b@(FunMonoBind _ _ _ _) -> group (Just b) binds
other -> bind `RdrAndBindings` group Nothing binds
plus_RDR = mkUnqual varName SLIT("+")
\end{code}
{-
-----------------------------------------------------------------------------
$Id: Parser.y,v 1.45 2000/10/26 16:51:44 sewardj Exp $
$Id: Parser.y,v 1.46 2000/10/31 17:30:17 simonpj Exp $
Haskell grammar.
......@@ -19,7 +19,7 @@ import RdrHsSyn
import Lex
import ParseUtil
import RdrName
import PrelInfo ( mAIN_Name )
import PrelNames
import OccName ( UserFS, varName, ipName, tcName, dataName, tcClsName, tvName )
import SrcLoc ( SrcLoc )
import Module
......@@ -732,8 +732,8 @@ aexp1 :: { RdrNameHsExpr }
: ipvar { HsIPVar $1 }
| var_or_con { $1 }
| literal { HsLit $1 }
| INTEGER { HsOverLit (mkHsIntegralLit $1) }
| RATIONAL { HsOverLit (mkHsFractionalLit $1) }
| INTEGER { HsOverLit (HsIntegral $1 fromInteger_RDR) }
| RATIONAL { HsOverLit (HsFractional $1 fromRational_RDR) }
| '(' exp ')' { HsPar $2 }
| '(' exp ',' texps ')' { ExplicitTuple ($2 : reverse $4) Boxed}
| '(#' texps '#)' { ExplicitTuple (reverse $2) Unboxed }
......
......@@ -50,13 +50,7 @@ module RdrHsSyn (
extractHsCtxtRdrTyVars, extractGenericPatTyVars,
mkHsOpApp, mkClassDecl, mkClassOpSig, mkConDecl,
mkHsNegApp, mkHsIntegralLit, mkHsFractionalLit, mkNPlusKPatIn,
-- some built-in names (all :: RdrName)
unitCon_RDR, unitTyCon_RDR, nilCon_RDR, listTyCon_RDR,
tupleCon_RDR, tupleTyCon_RDR, ubxTupleCon_RDR, ubxTupleTyCon_RDR,
funTyCon_RDR,
mkHsNegApp,
cvBinds,
cvMonoBindsAndSigs,
......@@ -68,18 +62,16 @@ module RdrHsSyn (
#include "HsVersions.h"
import HsSyn -- Lots of it
import CmdLineOpts ( opt_NoImplicitPrelude )
import HsPat ( collectSigTysFromPats )
import OccName ( mkClassTyConOcc, mkClassDataConOcc, mkWorkerOcc,
mkSuperDictSelOcc, mkDefaultMethodOcc, mkGenOcc1,
mkGenOcc2, varName, dataName, tcName
mkGenOcc2,
)
import PrelNames ( pRELUDE_Name, mkTupNameStr )
import RdrName ( RdrName, isRdrTyVar, mkRdrUnqual, rdrNameOcc,
mkUnqual, mkPreludeQual
import PrelNames ( negate_RDR )
import RdrName ( RdrName, isRdrTyVar, mkRdrIfaceUnqual, rdrNameOcc,
)
import List ( nub )
import BasicTypes ( Boxity(..), RecFlag(..) )
import BasicTypes ( RecFlag(..) )
import Class ( DefMeth (..) )
\end{code}
......@@ -224,10 +216,10 @@ mkClassDecl cxt cname tyvars fds sigs mbinds loc
where
cls_occ = rdrNameOcc cname
data_occ = mkClassDataConOcc cls_occ
dname = mkRdrUnqual data_occ
dwname = mkRdrUnqual (mkWorkerOcc data_occ)
tname = mkRdrUnqual (mkClassTyConOcc cls_occ)
sc_sel_names = [ mkRdrUnqual (mkSuperDictSelOcc n cls_occ)
dname = mkRdrIfaceUnqual data_occ
dwname = mkRdrIfaceUnqual (mkWorkerOcc data_occ)
tname = mkRdrIfaceUnqual (mkClassTyConOcc cls_occ)
sc_sel_names = [ mkRdrIfaceUnqual (mkSuperDictSelOcc n cls_occ)
| n <- [1..length cxt]]
-- We number off the superclass selectors, 1, 2, 3 etc so that we
-- can construct names for the selectors. Thus
......@@ -241,22 +233,22 @@ mkClassDecl cxt cname tyvars fds sigs mbinds loc
-- mkTyData :: ??
mkTyData new_or_data context tname list_var list_con i maybe src
= let t_occ = rdrNameOcc tname
name1 = mkRdrUnqual (mkGenOcc1 t_occ)
name2 = mkRdrUnqual (mkGenOcc2 t_occ)
name1 = mkRdrIfaceUnqual (mkGenOcc1 t_occ)
name2 = mkRdrIfaceUnqual (mkGenOcc2 t_occ)
in TyData new_or_data context
tname list_var list_con i maybe src name1 name2
mkClassOpSig (DefMeth x) op ty loc
= ClassOpSig op (Just (DefMeth dm_rn)) ty loc
where
dm_rn = mkRdrUnqual (mkDefaultMethodOcc (rdrNameOcc op))
dm_rn = mkRdrIfaceUnqual (mkDefaultMethodOcc (rdrNameOcc op))
mkClassOpSig x op ty loc =
ClassOpSig op (Just x) ty loc
mkConDecl cname ex_vars cxt details loc
= ConDecl cname wkr_name ex_vars cxt details loc
where
wkr_name = mkRdrUnqual (mkWorkerOcc (rdrNameOcc cname))
wkr_name = mkRdrIfaceUnqual (mkWorkerOcc (rdrNameOcc cname))
\end{code}
\begin{code}
......@@ -278,19 +270,7 @@ mkHsNegApp (HsLit (HsDoublePrim i)) = HsLit (HsDoublePrim (-i))
mkHsNegApp (HsOverLit (HsIntegral i n)) = HsOverLit (HsIntegral (-i) n)
mkHsNegApp (HsOverLit (HsFractional f n)) = HsOverLit (HsFractional (-f) n)
mkHsNegApp expr = NegApp expr (prelQual varName SLIT("negate"))
\end{code}
\begin{code}
mkHsIntegralLit :: Integer -> HsOverLit RdrName
mkHsIntegralLit i = HsIntegral i (prelQual varName SLIT("fromInteger"))
mkHsFractionalLit :: Rational -> HsOverLit RdrName
mkHsFractionalLit f = HsFractional f (prelQual varName SLIT("fromRational"))
mkNPlusKPatIn :: RdrName -> HsOverLit RdrName -> RdrNamePat
mkNPlusKPatIn n k = NPlusKPatIn n k (prelQual varName SLIT("-"))
mkHsNegApp expr = NegApp expr negate_RDR
\end{code}
A useful function for building @OpApps@. The operator is always a
......@@ -300,30 +280,6 @@ variable, and we don't know the fixity yet.
mkHsOpApp e1 op e2 = OpApp e1 (HsVar op) (error "mkOpApp:fixity") e2
\end{code}
\begin{code}
-----------------------------------------------------------------------------
-- Built-in names
-- Qualified Prelude names are always in scope; so we can just say Prelude.[]
-- for the list type constructor, say. But it's not so easy when we say
-- -fno-implicit-prelude. Then you just get whatever "[]" happens to be in scope.
unitCon_RDR, unitTyCon_RDR, nilCon_RDR, listTyCon_RDR :: RdrName
tupleCon_RDR, tupleTyCon_RDR :: Int -> RdrName
ubxTupleCon_RDR, ubxTupleTyCon_RDR :: Int -> RdrName
unitCon_RDR = prelQual dataName SLIT("()")
unitTyCon_RDR = prelQual tcName SLIT("()")
nilCon_RDR = prelQual dataName SLIT("[]")
listTyCon_RDR = prelQual tcName SLIT("[]")
funTyCon_RDR = prelQual tcName SLIT("(->)")
tupleCon_RDR arity = prelQual dataName (snd (mkTupNameStr Boxed arity))
tupleTyCon_RDR arity = prelQual tcName (snd (mkTupNameStr Boxed arity))
ubxTupleCon_RDR arity = prelQual dataName (snd (mkTupNameStr Unboxed arity))
ubxTupleTyCon_RDR arity = prelQual tcName (snd (mkTupNameStr Unboxed arity))
prelQual ns occ | opt_NoImplicitPrelude = mkUnqual ns occ
| otherwise = mkPreludeQual ns pRELUDE_Name occ
\end{code}
%************************************************************************
%* *
......
......@@ -37,8 +37,8 @@ module PrelNames (
#include "HsVersions.h"
import Module ( ModuleName, mkPrelModule, mkModuleName )
import OccName ( NameSpace, varName, dataName, tcName, clsName )
import RdrName ( RdrName, mkPreludeQual )
import OccName ( NameSpace, UserFS, varName, dataName, tcName, clsName )
import RdrName ( RdrName, mkOrig )
import UniqFM
import Unique ( Unique, Uniquable(..), hasKey,
mkPreludeMiscIdUnique, mkPreludeDataConUnique,
......@@ -217,7 +217,7 @@ pREL_FLOAT = mkPrelModule pREL_FLOAT_Name
%************************************************************************
\begin{code}
mkTupNameStr :: Boxity -> Int -> (ModuleName, FAST_STRING)
mkTupNameStr :: Boxity -> Int -> (ModuleName, UserFS)
mkTupNameStr Boxed 0 = (pREL_BASE_Name, SLIT("()"))
mkTupNameStr Boxed 1 = panic "Name.mkTupNameStr: 1 ???"
......@@ -235,7 +235,7 @@ mkTupNameStr Unboxed n = (pREL_GHC_Name, _PK_ ("(#" ++ nOfThem (n-1) ',' ++ "#)"
mkTupConRdrName :: NameSpace -> Boxity -> Arity -> RdrName
mkTupConRdrName space boxity arity = case mkTupNameStr boxity arity of
(mod, occ) -> mkPreludeQual space mod occ
(mod, occ) -> mkOrig space mod occ
\end{code}
......@@ -245,7 +245,7 @@ mkTupConRdrName space boxity arity = case mkTupNameStr boxity arity of
%* *
%************************************************************************
These RdrNames are not really "built in", but some parts of the
Many of these Names are not really "built in", but some parts of the
compiler (notably the deriving mechanism) need to mention their names,
and it's convenient to write them all down in one place.
......@@ -417,16 +417,21 @@ The following names are known to the compiler, but they don't require
pre-assigned keys. Mostly these names are used in generating deriving
code, which is passed through the renamer anyway.
THEY ARE ALL ORIGINAL NAMES, HOWEVER
\begin{code}
unpackCString_RDR = varQual_RDR pREL_BASE_Name SLIT("unpackCString#")
unpackCStringFoldr_RDR = varQual_RDR pREL_BASE_Name SLIT("unpackFoldrCString#")
unpackCStringUtf8_RDR = varQual_RDR pREL_BASE_Name SLIT("unpackCStringUtf8#")
deRefStablePtr_RDR = varQual_RDR pREL_STABLE_Name SLIT("deRefStablePtr")
makeStablePtr_RDR = varQual_RDR pREL_STABLE_Name SLIT("makeStablePtr")
bindIO_RDR = varQual_RDR pREL_IO_BASE_Name SLIT("bindIO")
returnIO_RDR = varQual_RDR pREL_IO_BASE_Name SLIT("returnIO")
main_RDR = varQual_RDR mAIN_Name SLIT("main")
-- Lists and tuples
tupleCon_RDR, tupleTyCon_RDR :: Int -> RdrName
ubxTupleCon_RDR, ubxTupleTyCon_RDR :: Int -> RdrName
tupleCon_RDR = mkTupConRdrName dataName Boxed
tupleTyCon_RDR = mkTupConRdrName tcName Boxed
ubxTupleCon_RDR = mkTupConRdrName dataName Unboxed
ubxTupleTyCon_RDR = mkTupConRdrName tcName Unboxed
unitCon_RDR = dataQual_RDR pREL_BASE_Name SLIT("()")
unitTyCon_RDR = tcQual_RDR pREL_BASE_Name SLIT("()")
and_RDR = varQual_RDR pREL_BASE_Name SLIT("&&")
not_RDR = varQual_RDR pREL_BASE_Name SLIT("not")
compose_RDR = varQual_RDR pREL_BASE_Name SLIT(".")
......@@ -464,20 +469,78 @@ maxBound_RDR = varQual_RDR pREL_ENUM_Name SLIT("maxBound")
assertErr_RDR = varQual_RDR pREL_ERR_Name SLIT("assertError")
\end{code}
These RDR names also have known keys, so we need to get back the RDR names to
populate the occurrence list above.
\begin{code}
funTyCon_RDR = nameRdrName funTyConName
nilCon_RDR = nameRdrName nilDataConName
listTyCon_RDR = nameRdrName listTyConName
ioTyCon_RDR = nameRdrName ioTyConName
intTyCon_RDR = nameRdrName intTyConName
eq_RDR = nameRdrName eqName
ge_RDR = nameRdrName geName
numClass_RDR = nameRdrName numClassName
ordClass_RDR = nameRdrName ordClassName
map_RDR = nameRdrName mapName
append_RDR = nameRdrName appendName
foldr_RDR = nameRdrName foldrName
build_RDR = nameRdrName buildName
enumFromTo_RDR = nameRdrName enumFromToName
returnM_RDR = nameRdrName returnMName
thenM_RDR = nameRdrName thenMName
failM_RDR = nameRdrName failMName
false_RDR = nameRdrName falseDataConName
true_RDR = nameRdrName trueDataConName
error_RDR = nameRdrName errorName
getTag_RDR = nameRdrName getTagName
fromEnum_RDR = nameRdrName fromEnumName
toEnum_RDR = nameRdrName toEnumName
enumFrom_RDR = nameRdrName enumFromName
mkInt_RDR = nameRdrName intDataConName
enumFromThen_RDR = nameRdrName enumFromThenName
enumFromThenTo_RDR = nameRdrName enumFromThenToName
ratioDataCon_RDR = nameRdrName ratioDataConName
plusInteger_RDR = nameRdrName plusIntegerName
timesInteger_RDR = nameRdrName timesIntegerName
enumClass_RDR = nameRdrName enumClassName
monadClass_RDR = nameRdrName monadClassName
ioDataCon_RDR = nameRdrName ioDataConName
cCallableClass_RDR = nameRdrName cCallableClassName
cReturnableClass_RDR = nameRdrName cReturnableClassName
eqClass_RDR = nameRdrName eqClassName
eqString_RDR = nameRdrName eqStringName
unpackCString_RDR = nameRdrName unpackCStringName
unpackCStringFoldr_RDR = nameRdrName unpackCStringFoldrName
unpackCStringUtf8_RDR = nameRdrName unpackCStringUtf8Name
deRefStablePtr_RDR = nameRdrName deRefStablePtrName
makeStablePtr_RDR = nameRdrName makeStablePtrName
bindIO_RDR = nameRdrName bindIOName
returnIO_RDR = nameRdrName returnIOName
main_RDR = nameRdrName mainName
fromInteger_RDR = nameRdrName fromIntegerName
fromRational_RDR = nameRdrName fromRationalName
minus_RDR = nameRdrName minusName
\end{code}
%************************************************************************
%* *
\subsection{Local helpers}
%* *
%************************************************************************
\begin{code}
varQual mod str uq = mkKnownKeyGlobal (mkPreludeQual varName mod str) uq
dataQual mod str uq = mkKnownKeyGlobal (mkPreludeQual dataName mod str) uq
tcQual mod str uq = mkKnownKeyGlobal (mkPreludeQual tcName mod str) uq
clsQual mod str uq = mkKnownKeyGlobal (mkPreludeQual clsName mod str) uq
All these are original names; hence mkOrig
varQual_RDR mod str = mkPreludeQual varName mod str
dataQual_RDR mod str = mkPreludeQual dataName mod str
\begin{code}
varQual mod str uq = mkKnownKeyGlobal (varQual_RDR mod str) uq
dataQual mod str uq = mkKnownKeyGlobal (dataQual_RDR mod str) uq
tcQual mod str uq = mkKnownKeyGlobal (tcQual_RDR mod str) uq
clsQual mod str uq = mkKnownKeyGlobal (clsQual_RDR mod str) uq
varQual_RDR mod str = mkOrig varName mod str
tcQual_RDR mod str = mkOrig tcName mod str
clsQual_RDR mod str = mkOrig clsName mod str
dataQual_RDR mod str = mkOrig dataName mod str
\end{code}
%************************************************************************
......@@ -790,43 +853,6 @@ deriving_occ_info
-- or for taggery.
-- ordClass: really it's the methods that are actually used.
-- numClass: for Int literals
-- these RDR names also have known keys, so we need to get back the RDR names to
-- populate the occurrence list above.
ioTyCon_RDR = nameRdrName ioTyConName
intTyCon_RDR = nameRdrName intTyConName
eq_RDR = nameRdrName eqName
ge_RDR = nameRdrName geName
numClass_RDR = nameRdrName numClassName
ordClass_RDR = nameRdrName ordClassName
map_RDR = nameRdrName mapName
append_RDR = nameRdrName appendName
foldr_RDR = nameRdrName foldrName
build_RDR = nameRdrName buildName
enumFromTo_RDR = nameRdrName enumFromToName
returnM_RDR = nameRdrName returnMName
thenM_RDR = nameRdrName thenMName
failM_RDR = nameRdrName failMName
false_RDR = nameRdrName falseDataConName