summaryrefslogtreecommitdiff
path: root/docs/users_guide
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 /docs/users_guide
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 'docs/users_guide')
-rw-r--r--docs/users_guide/flags.xml6
-rw-r--r--docs/users_guide/glasgow_exts.xml23
2 files changed, 29 insertions, 0 deletions
diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml
index ef57f13730..32eb56548c 100644
--- a/docs/users_guide/flags.xml
+++ b/docs/users_guide/flags.xml
@@ -959,6 +959,12 @@
<entry>dynamic</entry>
<entry><option>-XNoFunctionalDependencies</option></entry>
</row>
+ <row>
+ <entry><option>-XPackageImports</option></entry>
+ <entry>Enable <link linkend="package-imports">package-qualified imports</link>.</entry>
+ <entry>dynamic</entry>
+ <entry><option>-XNoPackageImports</option></entry>
+ </row>
</tbody>
</tgroup>
</informaltable>
diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml
index 63c5dbdf2e..14848159a4 100644
--- a/docs/users_guide/glasgow_exts.xml
+++ b/docs/users_guide/glasgow_exts.xml
@@ -1568,6 +1568,29 @@ necessary to enable them.
</para>
</sect2>
+<sect2 id="package-imports">
+ <title>Package-qualified imports</title>
+
+ <para>With the <option>-XPackageImports</option> flag, GHC allows
+ import declarations to be qualified by the package name that the
+ module is intended to be imported from. For example:</para>
+
+<programlisting>
+import "network" Network.Socket
+</programlisting>
+
+ <para>would import the module <literal>Network.Socket</literal> from
+ the package <literal>network</literal> (any version). This may
+ be used to disambiguate an import when the same module is
+ available from multiple packages, or is present in both the
+ current package being built and an external package.</para>
+
+ <para>Note: you probably don't need to use this feature, it was
+ added mainly so that we can build backwards-compatible versions of
+ packages when APIs change. It can lead to fragile dependencies in
+ the common case: modules occasionally move from one package to
+ another, rendering any package-qualified imports broken.</para>
+</sect2>
</sect1>