diff options
author | Simon Marlow <marlowsd@gmail.com> | 2008-08-05 13:35:44 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2008-08-05 13:35:44 +0000 |
commit | 1867a7bb8c59ea514b4f47f5434842543933ec9a (patch) | |
tree | 4f622970ba88bf408e2884d0ea3819230abf1232 /compiler/hsSyn | |
parent | ea9a5be67418ab76c4fa33736a3335b517c9e7f9 (diff) | |
download | haskell-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/hsSyn')
-rw-r--r-- | compiler/hsSyn/HsImpExp.lhs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/hsSyn/HsImpExp.lhs b/compiler/hsSyn/HsImpExp.lhs index 4e58dd71f0..099537f9d0 100644 --- a/compiler/hsSyn/HsImpExp.lhs +++ b/compiler/hsSyn/HsImpExp.lhs @@ -35,6 +35,7 @@ type LImportDecl name = Located (ImportDecl name) data ImportDecl name = ImportDecl (Located ModuleName) -- module name + (Maybe FastString) -- package qualifier Bool -- True <=> {-# SOURCE #-} import Bool -- True => qualified (Maybe ModuleName) -- as Module @@ -43,11 +44,14 @@ data ImportDecl name \begin{code} instance (Outputable name) => Outputable (ImportDecl name) where - ppr (ImportDecl mod from qual as spec) + ppr (ImportDecl mod pkg from qual as spec) = hang (hsep [ptext (sLit "import"), ppr_imp from, - pp_qual qual, ppr mod, pp_as as]) + pp_qual qual, pp_pkg pkg, ppr mod, pp_as as]) 4 (pp_spec spec) where + pp_pkg Nothing = empty + pp_pkg (Just p) = doubleQuotes (ftext p) + pp_qual False = empty pp_qual True = ptext (sLit "qualified") @@ -64,7 +68,7 @@ instance (Outputable name) => Outputable (ImportDecl name) where = ptext (sLit "hiding") <+> parens (interpp'SP spec) ideclName :: ImportDecl name -> Located ModuleName -ideclName (ImportDecl mod_nm _ _ _ _) = mod_nm +ideclName (ImportDecl mod_nm _ _ _ _ _) = mod_nm \end{code} %************************************************************************ |