Commit 9579283c authored by simonpj's avatar simonpj
Browse files

[project @ 2000-04-13 11:56:35 by simonpj]

Add support for 'packages'.

* A package is a group of modules.

* A package has a name (e.g. std)

* A package is built into a single library (Unix; e.g. libHSstd.a)
                       or a single DLL     (Windows; e.g. HSstd.dll)

* The '-package-name foo' flag tells GHC that the module being compiled
  is destined for package foo.

* The '-package foo' flag tells GHC to make available modules
  from package 'foo'.  It replaces '-syslib foo' which is now deprecated.

* Cross-package references cost an extra indirection in Windows,
  but not Unix

* GHC does not maintain detailed cross-package dependency information.
  It does remember which modules in other packages the current module
  depends on, but not which things within those imported things.


All of this tidies up the Prelude enormously.  The Prelude and
Standard Libraries are built into a singl package called 'std'.  (This
is a change; the library is now called libHSstd.a instead of libHS.a)
parent 41c2bcab
%
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
% $Id: CLabel.lhs,v 1.32 2000/03/23 17:45:17 simonpj Exp $
% $Id: CLabel.lhs,v 1.33 2000/04/13 11:56:35 simonpj Exp $
%
\section[CLabel]{@CLabel@: Information to make C Labels}
......@@ -70,8 +70,8 @@ import {-# SOURCE #-} MachMisc ( underscorePrefix, fmtAsmLbl )
import CmdLineOpts ( opt_Static, opt_DoTickyProfiling )
import CStrings ( pp_cSEP )
import DataCon ( ConTag, DataCon )
import Module ( isDynamicModule, ModuleName, moduleNameString )
import Name ( Name, getName, isExternallyVisibleName, nameModule, isLocallyDefinedName )
import Module ( ModuleName )
import Name ( Name, getName, isDllName, isExternallyVisibleName )
import TyCon ( TyCon )
import Unique ( pprUnique, Unique )
import PrimOp ( PrimOp, pprPrimOp )
......@@ -337,12 +337,11 @@ in a DLL, be it a data reference or not.
labelDynamic :: CLabel -> Bool
labelDynamic lbl =
case lbl of
RtsLabel _ -> not opt_Static -- i.e., is the RTS in a DLL or not?
IdLabel n k | not (isLocallyDefinedName n) -> isDynamicModule (nameModule n)
DataConLabel n k | not (isLocallyDefinedName n) -> isDynamicModule (nameModule n)
TyConLabel tc | not (isLocallyDefinedName (getName tc)) -> isDynamicModule (nameModule (getName tc))
_ -> False
RtsLabel _ -> not opt_Static -- i.e., is the RTS in a DLL or not?
IdLabel n k -> isDllName n
DataConLabel n k -> isDllName n
TyConLabel tc -> isDllName (getName tc)
_ -> False
\end{code}
......
......@@ -599,16 +599,14 @@ ppLocalnessMacro include_dyn_prefix clabel =
where
is_visible = externallyVisibleCLabel clabel
label_type = labelType clabel
is_dynamic = labelDynamic clabel
visiblity_prefix
| is_visible = char 'E'
| otherwise = char 'I'
dyn_prefix
| not include_dyn_prefix = empty
| is_dynamic = char 'D'
| otherwise = empty
| include_dyn_prefix && labelDynamic clabel = char 'D'
| otherwise = empty
\end{code}
......
......@@ -14,7 +14,7 @@ module DataCon (
dataConFieldLabels, dataConStrictMarks,
dataConSourceArity, dataConRepArity,
dataConNumInstArgs, dataConId, dataConWrapId, dataConRepStrictness,
isNullaryDataCon, isTupleCon, isUnboxedTupleCon, isDynDataCon,
isNullaryDataCon, isTupleCon, isUnboxedTupleCon,
isExistentialDataCon,
splitProductType_maybe, splitProductType,
......@@ -37,7 +37,7 @@ import Type ( Type, ThetaType, TauType, ClassContext,
import TyCon ( TyCon, tyConDataCons, isDataTyCon, isProductTyCon,
isTupleTyCon, isUnboxedTupleTyCon, isRecursiveTyCon )
import Class ( classTyCon )
import Name ( Name, NamedThing(..), nameUnique, isDynName, isLocallyDefined )
import Name ( Name, NamedThing(..), nameUnique, isLocallyDefined )
import Var ( TyVar, Id )
import FieldLabel ( FieldLabel )
import BasicTypes ( Arity )
......@@ -386,9 +386,6 @@ isUnboxedTupleCon (MkData {dcTyCon = tc}) = isUnboxedTupleTyCon tc
isExistentialDataCon :: DataCon -> Bool
isExistentialDataCon (MkData {dcExTyVars = tvs}) = not (null tvs)
isDynDataCon :: DataCon -> Bool
isDynDataCon con = isDynName (dataConName con)
\end{code}
......
......@@ -21,9 +21,9 @@ module Module
, mkVanillaModule -- :: ModuleName -> Module
, mkThisModule -- :: ModuleName -> Module
, mkPrelModule -- :: UserString -> Module
, mkModule -- :: ModuleName -> PackageName -> Module
, isDynamicModule -- :: Module -> Bool
, isPrelModule
, isLocalModule -- :: Module -> Bool
, mkSrcModule
......@@ -32,11 +32,7 @@ module Module
, pprModule, pprModuleName
-- DllFlavour
, DllFlavour, dll, notDll
-- ModFlavour
, ModFlavour,
, PackageName
-- Where to find a .hi file
, WhereFrom(..), SearchPath, mkSearchPath
......@@ -48,7 +44,7 @@ module Module
import OccName
import Outputable
import FiniteMap
import CmdLineOpts ( opt_Static, opt_CompilingPrelude, opt_WarnHiShadows, opt_HiMapSep )
import CmdLineOpts ( opt_Static, opt_InPackage, opt_WarnHiShadows, opt_HiMapSep )
import Constants ( interfaceFileFormatVersion )
import Maybes ( seqMaybe )
import Maybe ( fromMaybe )
......@@ -57,6 +53,7 @@ import DirUtils ( getDirectoryContents )
import List ( intersperse )
import Monad ( foldM )
import IO ( hPutStrLn, stderr, isDoesNotExistError )
import FastString ( FastString )
\end{code}
......@@ -78,16 +75,18 @@ The logic for how an interface file is marked as corresponding to a module that'
hiding in a DLL is explained elsewhere (ToDo: give renamer href here.)
\begin{code}
data DllFlavour = NotDll -- Ordinary module
| Dll -- The module's object code lives in a DLL.
deriving( Eq )
data PackageInfo = ThisPackage -- A module from the same package
-- as the one being compiled
| AnotherPackage PackageName -- A module from a different package
type PackageName = FastString -- No encoding at all
dll = Dll
notDll = NotDll
preludePackage :: PackageName
preludePackage = SLIT("prelude")
instance Show DllFlavour where -- Just used in debug prints of lex tokens
showsPrec n NotDll s = s
showsPrec n Dll s = "dll " ++ s
instance Show PackageInfo where -- Just used in debug prints of lex tokens
showsPrec n ThisPackage s = s
showsPrec n (AnotherPackage p) s = (_UNPK_ p) ++ s
\end{code}
......@@ -145,19 +144,6 @@ type ModuleName = EncodedFS
-- Haskell module names can include the quote character ',
-- so the module names have the z-encoding applied to them
-- True for names of prelude modules
isPrelModuleName :: ModuleName -> Bool
-- HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK
-- HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK
-- HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK
-- HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK
isPrelModuleName m = take 4 m_str == "Prel" && m_str /= "PrelInfo"
where m_str = _UNPK_ m
-- HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK
-- HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK
-- HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK
-- HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK
pprModuleName :: ModuleName -> SDoc
pprModuleName nm = pprEncodedFS nm
......@@ -178,10 +164,7 @@ mkSysModuleFS s = s
\end{code}
\begin{code}
data Module = Module
ModuleName
ModFlavour
DllFlavour
data Module = Module ModuleName PackageInfo
\end{code}
\begin{code}
......@@ -189,80 +172,59 @@ instance Outputable Module where
ppr = pprModule
instance Eq Module where
(Module m1 _ _) == (Module m2 _ _) = m1 == m2
(Module m1 _) == (Module m2 _) = m1 == m2
instance Ord Module where
(Module m1 _ _) `compare` (Module m2 _ _) = m1 `compare` m2
(Module m1 _) `compare` (Module m2 _) = m1 `compare` m2
\end{code}
\begin{code}
pprModule :: Module -> SDoc
pprModule (Module mod _ _) = getPprStyle $ \ sty ->
if userStyle sty then
pprModule (Module mod _) = getPprStyle $ \ sty ->
if userStyle sty then
text (moduleNameUserString mod)
else
else
pprModuleName mod
\end{code}
\begin{code}
mkModule :: FilePath -- Directory in which this module is
-> ModuleName -- Name of the module
-> DllFlavour
mkModule :: ModuleName -- Name of the module
-> PackageName
-> Module
mkModule dir_path mod_nm is_dll
| isPrelModuleName mod_nm = mkPrelModule mod_nm
| otherwise = Module mod_nm UserMod is_dll
-- Make every module into a 'user module'
-- except those constructed by mkPrelModule
mkModule mod_nm pack_name
= Module mod_nm pack_info
where
pack_info | pack_name == opt_InPackage = ThisPackage
| otherwise = AnotherPackage pack_name
mkVanillaModule :: ModuleName -> Module
mkVanillaModule name = Module name UserMod dell
where
main_mod = mkSrcModuleFS SLIT("Main")
-- Main can never be in a DLL - need this
-- special case in order to correctly
-- compile PrelMain
dell | opt_Static || opt_CompilingPrelude ||
name == main_mod = NotDll
| otherwise = Dll
mkVanillaModule name = Module name (pprTrace "mkVanillaModule" (ppr name) ThisPackage)
-- Used temporarily when we first come across Foo.x in an interface
-- file, but before we've opened Foo.hi.
-- (Until we've opened Foo.hi we don't know what the PackageInfo is.)
mkThisModule :: ModuleName -> Module -- The module being comiled
mkThisModule name =
Module name UserMod NotDll -- This is fine, a Dll flag is only
-- pinned on imported modules.
mkThisModule name = Module name ThisPackage
mkPrelModule :: ModuleName -> Module
mkPrelModule name = Module name sys dll
where
sys | opt_CompilingPrelude = UserMod
| otherwise = PrelMod
dll | opt_Static || opt_CompilingPrelude = NotDll
| otherwise = Dll
mkPrelModule name = mkModule name preludePackage
moduleString :: Module -> EncodedString
moduleString (Module mod _ _) = _UNPK_ mod
moduleString (Module mod _) = _UNPK_ mod
moduleName :: Module -> ModuleName
moduleName (Module mod _ _) = mod
moduleName (Module mod _) = mod
moduleUserString :: Module -> UserString
moduleUserString (Module mod _ _) = moduleNameUserString mod
moduleUserString (Module mod _) = moduleNameUserString mod
\end{code}
\begin{code}
isDynamicModule :: Module -> Bool
isDynamicModule (Module _ _ Dll) = True
isDynamicModule _ = False
isPrelModule :: Module -> Bool
isPrelModule (Module _ PrelMod _) = True
isPrelModule _ = False
isLocalModule :: Module -> Bool
isLocalModule (Module _ ThisPackage) = True
isLocalModule _ = False
\end{code}
......@@ -273,10 +235,10 @@ isPrelModule _ = False
%************************************************************************
\begin{code}
type ModuleHiMap = FiniteMap ModuleName (String, Module)
type ModuleHiMap = FiniteMap ModuleName String
-- Mapping from module name to
-- * the file path of its corresponding interface file,
-- * the Module, decorated with it's properties
-- * the ModuleName
\end{code}
(We allege that) it is quicker to build up a mapping from module names
......@@ -293,17 +255,6 @@ mkModuleHiMaps dirs = foldM (getAllFilesMatching dirs) (env,env) dirs
where
env = emptyFM
{- A pseudo file, currently "dLL_ifs.hi",
signals that the interface files
contained in a particular directory have got their
corresponding object codes stashed away in a DLL
This stuff is only needed to deal with Win32 DLLs,
and conceivably we conditionally compile in support
for handling it. (ToDo?)
-}
dir_contain_dll_his = "dLL_ifs.hi"
getAllFilesMatching :: SearchPath
-> (ModuleHiMap, ModuleHiMap)
-> (FilePath, String)
......@@ -311,15 +262,7 @@ getAllFilesMatching :: SearchPath
getAllFilesMatching dirs hims (dir_path, suffix) = ( do
-- fpaths entries do not have dir_path prepended
fpaths <- getDirectoryContents dir_path
is_dll <- catch
(if opt_Static || dir_path == "." then
return NotDll
else
do exists <- doesFileExist (dir_path ++ '/': dir_contain_dll_his)
return (if exists then Dll else NotDll)
)
(\ _ {-don't care-} -> return NotDll)
return (foldl (addModules is_dll) hims fpaths))
return (foldl addModules hims fpaths))
-- soft failure
`catch`
(\ err -> do
......@@ -343,7 +286,7 @@ getAllFilesMatching dirs hims (dir_path, suffix) = ( do
reverse (show interfaceFileFormatVersion) ++ '-':hi_boot_xiffus
hi_boot_xiffus = "toob-ih." -- .hi-boot reversed!
addModules is_dll his@(hi_env, hib_env) filename = fromMaybe his $
addModules his@(hi_env, hib_env) filename = fromMaybe his $
FMAP add_hi (go xiffus rev_fname) `seqMaybe`
FMAP add_vhib (go hi_boot_version_xiffus rev_fname) `seqMaybe`
......@@ -363,7 +306,7 @@ getAllFilesMatching dirs hims (dir_path, suffix) = ( do
add_hib file_nm = (hi_env, add_to_map addNewOne hib_env file_nm)
add_to_map combiner env file_nm
= addToFM_C combiner env mod_nm (path, mkModule dir_path mod_nm is_dll)
= addToFM_C combiner env mod_nm path
where
mod_nm = mkSrcModuleFS file_nm
......@@ -379,15 +322,15 @@ getAllFilesMatching dirs hims (dir_path, suffix) = ( do
stickWithOld old new = old
overrideNew old new = new
conflict (old_path,mod) (new_path,_)
conflict old_path new_path
| old_path /= new_path =
pprTrace "Warning: " (text "Identically named interface files present on the import path, " $$
text (show old_path) <+> text "shadows" $$
text (show new_path) $$
text "on the import path: " <+>
text (concat (intersperse ":" (map fst dirs))))
(old_path,mod)
| otherwise = (old_path,mod) -- don't warn about innocous shadowings.
old_path
| otherwise = old_path -- don't warn about innocous shadowings.
\end{code}
......
......@@ -25,7 +25,7 @@ module Name (
isUserExportedName, isUserImportedName, isUserImportedExplicitlyName,
maybeUserImportedFrom,
nameSrcLoc, isLocallyDefinedName, isDynName,
nameSrcLoc, isLocallyDefinedName, isDllName,
isSystemName, isLocalName, isGlobalName, isExternallyVisibleName,
......@@ -46,9 +46,9 @@ import {-# SOURCE #-} Var ( Id, setIdName )
import {-# SOURCE #-} TyCon ( TyCon, setTyConName )
import OccName -- All of it
import Module ( Module, moduleName, pprModule, mkVanillaModule, isDynamicModule )
import Module ( Module, moduleName, pprModule, mkVanillaModule, isLocalModule )
import RdrName ( RdrName, mkRdrQual, mkRdrUnqual, rdrNameOcc, rdrNameModule )
import CmdLineOpts ( opt_PprStyle_NoPrags, opt_OmitInterfacePragmas, opt_EnsureSplittableC )
import CmdLineOpts ( opt_Static, opt_PprStyle_NoPrags, opt_OmitInterfacePragmas, opt_EnsureSplittableC )
import SrcLoc ( noSrcLoc, mkBuiltinSrcLoc, SrcLoc )
import Unique ( pprUnique, Unique, Uniquable(..), unboundKey, u2i )
......@@ -435,10 +435,11 @@ isUserImportedName other = False
maybeUserImportedFrom (Name { n_prov = NonLocalDef (UserImport m _ _) _ }) = Just m
maybeUserImportedFrom other = Nothing
isDynName :: Name -> Bool
-- Does this name come from a DLL?
isDynName nm = not (isLocallyDefinedName nm) &&
isDynamicModule (nameModule nm)
isDllName :: Name -> Bool
-- Does this name refer to something in a different DLL?
isDllName nm = not opt_Static &&
not (isLocallyDefinedName nm) &&
not (isLocalModule (nameModule nm))
nameSrcLoc name = provSrcLoc (n_prov name)
......
......@@ -45,11 +45,10 @@ import ClosureInfo ( mkClosureLFInfo, mkConLFInfo, mkLFArgument,
import CostCentre ( currentOrSubsumedCCS, dontCareCCS, CostCentreStack,
currentCCS )
import DataCon ( DataCon, dataConName, dataConTag, dataConTyCon,
isUnboxedTupleCon, isNullaryDataCon, isDynDataCon, dataConId, dataConWrapId
isUnboxedTupleCon, isNullaryDataCon, dataConId, dataConWrapId
)
import Id ( Id, idName, idType, idPrimRep )
import Name ( nameModule, isLocallyDefinedName )
import Module ( isDynamicModule )
import Literal ( Literal(..) )
import PrelInfo ( maybeCharLikeCon, maybeIntLikeCon )
import PrimRep ( PrimRep(..), isFollowableRep )
......@@ -100,7 +99,7 @@ cgTopRhsCon id con args
top_ccc = mkCCostCentreStack dontCareCCS -- because it's static data
-- stuff needed by the assert pred only.
dynamic_con_or_args = isDynDataCon con || any isDynArg args
dynamic_con_or_args = isDllConApp con args
\end{code}
%************************************************************************
......
......@@ -405,7 +405,7 @@ pp_rbinds :: (Outputable id, Outputable pat)
pp_rbinds thing rbinds
= hang thing
4 (braces (hsep (punctuate comma (map (pp_rbind) rbinds))))
4 (braces (sep (punctuate comma (map (pp_rbind) rbinds))))
where
pp_rbind (v, e, pun_flag)
= getPprStyle $ \ sty ->
......
......@@ -119,7 +119,7 @@ module CmdLineOpts (
opt_UF_DearOp,
-- misc opts
opt_CompilingPrelude,
opt_InPackage,
opt_EmitCExternDecls,
opt_EnsureSplittableC,
opt_GranMacros,
......@@ -390,14 +390,15 @@ opt_UnfoldCasms = lookUp SLIT("-funfold-casms-in-hi-file")
opt_UsageSPOn = lookUp SLIT("-fusagesp-on")
opt_UnboxStrictFields = lookUp SLIT("-funbox-strict-fields")
{-
It's a bit unfortunate to have to re-introduce this chap, but on Win32
platforms we do need a way of distinguishing between the case when we're
compiling a static version of the Prelude and one that's going to be
put into a DLL. Why? Because the compiler's wired in modules need to
be attributed as either coming from a DLL or not.
-}
opt_CompilingPrelude = lookUp SLIT("-fcompiling-prelude")
{-
The optional '-inpackage=P' flag tells what package
we are compiling this module for.
The Prelude, for example is compiled with '-package prelude'
-}
opt_InPackage = case lookup_str "-inpackage=" of
Just p -> _PK_ p
Nothing -> SLIT("Main") -- The package name if none is specified
opt_EmitCExternDecls = lookUp SLIT("-femit-extern-decls")
opt_EnsureSplittableC = lookUp SLIT("-fglobalise-toplev-names")
opt_GranMacros = lookUp SLIT("-fgransim")
......
......@@ -103,8 +103,9 @@ startIface mod (InterfaceDetails has_orphans import_usages (ExportEnv avails fix
Just fn -> do
if_hdl <- openFile fn WriteMode
hPutStr if_hdl ("__interface " ++ moduleString mod)
hPutStr if_hdl (' ' : show (opt_HiVersion :: Int) ++ orphan_indicator)
hPutStr if_hdl ("__interface \"" ++ show opt_InPackage ++ "\" " ++ moduleString mod)
hPutStr if_hdl (' ' : show (opt_HiVersion :: Int))
hPutStr if_hdl (' ' : orphan_indicator)
hPutStrLn if_hdl " where"
ifaceExports if_hdl avails
ifaceImports if_hdl import_usages
......
......@@ -31,9 +31,10 @@ import OccName ( mkSysOccFS,
tcName, varName, ipName, dataName, clsName, tvName, uvName,
EncodedFS
)
import Module ( ModuleName, mkSysModuleFS )
import Module ( ModuleName, PackageName, mkSysModuleFS, mkModule )
import PrelInfo ( mkTupConRdrName, mkUbxTupConRdrName )
import SrcLoc ( SrcLoc )
import CmdLineOpts ( opt_InPackage )
import Maybes
import Outputable
......@@ -75,7 +76,6 @@ import Ratio ( (%) )
'then' { ITthen }
'type' { ITtype }
'where' { ITwhere }
--???? 'scc' { ITscc }
'forall' { ITforall } -- GHC extension keywords
'foreign' { ITforeign }
......@@ -176,31 +176,31 @@ import Ratio ( (%) )
-- (c) the IdInfo part of a signature (same reason)
iface_stuff :: { IfaceStuff }
iface_stuff : iface { let (nm, iff) = $1 in PIface nm iff }
iface_stuff : iface { PIface $1 }
| type { PType $1 }
| id_info { PIdInfo $1 }
| '__R' rules { PRules $2 }
| '__D' deprecs { PDeprecs $2 }
iface :: { (ModuleName, ParsedIface) }
iface : '__interface' mod_fs INTEGER orphans checkVersion 'where'
iface :: { ParsedIface }
iface : '__interface' package mod_name INTEGER orphans checkVersion 'where'
exports_part
import_part
instance_decl_part
decls_part
rules_and_deprecs
{ ( $2 -- Module name
, ParsedIface {
pi_mod = fromInteger $3, -- Module version
pi_orphan = $4,
pi_exports = $7, -- Exports
pi_usages = $8, -- Usages
pi_insts = $9, -- Local instances
pi_decls = $10, -- Decls
pi_rules = fst $11, -- Rules
pi_deprecs = snd $11 -- Deprecations
} ) }
{ ParsedIface {
pi_mod = mkModule $3 $2, -- Module itself
pi_vers = fromInteger $4, -- Module version
pi_orphan = $5,
pi_exports = $8, -- Exports
pi_usages = $9, -- Usages
pi_insts = $10, -- Local instances
pi_decls = $11, -- Decls
pi_rules = fst $12, -- Rules
pi_deprecs = snd $12 -- Deprecations
} }
--------------------------------------------------------------------------
......@@ -209,12 +209,11 @@ import_part : { [] }
| import_part import_decl { $2 : $1 }
import_decl :: { ImportVersion OccName }
import_decl : 'import' mod_fs INTEGER orphans is_boot whats_imported ';'
import_decl : 'import' mod_name INTEGER orphans is_boot whats_imported ';'
{ (mkSysModuleFS $2, fromInteger $3, $4, $5, $6) }
-- import Foo 3 :: a 1 b 3 c 7 ; means import a,b,c from Foo
-- import Foo 3 ; means import all of Foo
-- import Foo 3 ! @ :: ...stuff... ; the ! means that Foo contains orphans
-- and @ that Foo is a boot interface
-- import Foo 3 ! :: ...stuff... ; the ! means that Foo contains orphans
orphans :: { WhetherHasOrphans }
orphans : { False }
......@@ -242,7 +241,7 @@ name_version_pair : var_occ INTEGER { ($1, fromInteger $2) }
exports_part :: { [ExportItem] }
exports_part : { [] }
| exports_part '__export'
mod_fs entities ';' { (mkSysModuleFS $3, $4) : $1 }
mod_name entities ';' { (mkSysModuleFS $3, $4) : $1 }
entities :: { [RdrAvailInfo] }
entities : { [] }
......@@ -506,11 +505,14 @@ atypes :: { [RdrNameHsType] {- Zero or more -} }
atypes : { [] }
| atype atypes { $1 : $2 }
---------------------------------------------------------------------
mod_fs :: { EncodedFS }
: CONID { $1 }
package :: { PackageName }
: STRING { $1 }
| {- empty -} { opt_InPackage } -- Useful for .hi-boot files,
-- which can omit the package Id
-- Module loops are always within a package
mod_name :: { ModuleName }
: mod_fs { mkSysModuleFS $1 }
: CONID { mkSysModuleFS $1 }
---------------------------------------------------
......@@ -868,7 +870,7 @@ checkVersion :: { () }
happyError :: P a
happyError buf PState{ loc = loc } = PFailed (ifaceParseErr buf loc)
data IfaceStuff = PIface EncodedFS{-.hi module name-} ParsedIface
data IfaceStuff = PIface ParsedIface
| PIdInfo [HsIdInfo RdrName]
| PType RdrNameHsType
| PRules [RdrNameRuleDecl]
......
......@@ -344,8 +344,8 @@ slurpSourceRefs source_binders source_fvs
-- the free variables returned are simply 'listTyCon_Name',
-- with a system provenance. We could look them up every time
-- but that seems a waste.
| otherwise = loadHomeInterface doc name `thenRn_`
returnRn ()
| otherwise = loadHomeInterface doc name `thenRn_`
returnRn ()
where
doc = ptext SLIT("need home module for wired in thing") <+> ppr name
......
......@@ -35,7 +35,7 @@ import OccName ( OccName,
)
import TysWiredIn ( tupleTyCon, unboxedTupleTyCon, listTyCon )
import Type ( funTyCon )
import Module ( ModuleName, mkThisModule, moduleName )
import Module ( ModuleName, mkThisModule, moduleName, mkVanillaModule )
import TyCon ( TyCon )
import FiniteMap
import Unique ( Unique, Uniquable(..) )
......@@ -92,8 +92,7 @@ newImportedBinder mod rdr_name
-- Make an imported global name, checking first to see if it's in the cache
mkImportedGlobalName :: ModuleName -> OccName -> RnM d Name
mkImportedGlobalName mod_name occ
= lookupModuleRn mod_name `thenRn` \ mod ->
newImportedGlobalName mod_name occ mod
= newImportedGlobalName mod_name occ (mkVanillaModule mod_name)
mkImportedGlobalFromRdrName :: RdrName -> RnM d Name
mkImportedGlobalFromRdrName rdr_name
......
......@@ -50,7 +50,7 @@ import Name ( Name {-instance NamedThing-},
)
import Module ( Module, moduleString, pprModule,
mkVanillaModule, pprModuleName,