summaryrefslogtreecommitdiff
path: root/compiler/iface
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2008-08-05 13:35:44 +0000
committerSimon Marlow <marlowsd@gmail.com>2008-08-05 13:35:44 +0000
commit1867a7bb8c59ea514b4f47f5434842543933ec9a (patch)
tree4f622970ba88bf408e2884d0ea3819230abf1232 /compiler/iface
parentea9a5be67418ab76c4fa33736a3335b517c9e7f9 (diff)
downloadhaskell-1867a7bb8c59ea514b4f47f5434842543933ec9a.tar.gz
Add -XPackageImports, new syntax for package-qualified imports
Now you can say import "network" Network.Socket and get Network.Socket from package "network", even if there are multiple Network.Socket modules in scope from different packages and/or the current package. This is not really intended for general use, it's mainly so that we can build backwards-compatible versions of packages, where we need to be able to do module GHC.Base (module New.GHC.Base) where import "base" GHC.Base as New.GHC.Base
Diffstat (limited to 'compiler/iface')
-rw-r--r--compiler/iface/LoadIface.lhs11
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/iface/LoadIface.lhs b/compiler/iface/LoadIface.lhs
index 66cdf7881a..d7089f173b 100644
--- a/compiler/iface/LoadIface.lhs
+++ b/compiler/iface/LoadIface.lhs
@@ -70,15 +70,20 @@ import Data.Maybe
\begin{code}
-- | Load the interface corresponding to an @import@ directive in
-- source code. On a failure, fail in the monad with an error message.
-loadSrcInterface :: SDoc -> ModuleName -> IsBootInterface -> RnM ModIface
-loadSrcInterface doc mod want_boot = do
+loadSrcInterface :: SDoc
+ -> ModuleName
+ -> IsBootInterface -- {-# SOURCE #-} ?
+ -> Maybe FastString -- "package", if any
+ -> RnM ModIface
+
+loadSrcInterface doc mod want_boot maybe_pkg = do
-- We must first find which Module this import refers to. This involves
-- calling the Finder, which as a side effect will search the filesystem
-- and create a ModLocation. If successful, loadIface will read the
-- interface; it will call the Finder again, but the ModLocation will be
-- cached from the first search.
hsc_env <- getTopEnv
- res <- liftIO $ findImportedModule hsc_env mod Nothing
+ res <- liftIO $ findImportedModule hsc_env mod maybe_pkg
case res of
Found _ mod -> do
mb_iface <- initIfaceTcRn $ loadInterface doc mod (ImportByUser want_boot)