summaryrefslogtreecommitdiff
path: root/docs/users_guide/ghci.xml
diff options
context:
space:
mode:
Diffstat (limited to 'docs/users_guide/ghci.xml')
-rw-r--r--docs/users_guide/ghci.xml40
1 files changed, 29 insertions, 11 deletions
diff --git a/docs/users_guide/ghci.xml b/docs/users_guide/ghci.xml
index a1271e1ac1..399cda90ea 100644
--- a/docs/users_guide/ghci.xml
+++ b/docs/users_guide/ghci.xml
@@ -674,13 +674,13 @@ Prelude>
<title>What's really in scope at the prompt?</title>
<para>When you type an expression at the prompt, what
- identifiers and types are in scope?
+ identifiers and types are in scope?
GHCi provides a flexible
way to control exactly how the context for an expression is
constructed:
<itemizedlist>
<listitem><para>
- The <literal>:load</literal>, <literal>:add</literal>,
+ The <literal>:load</literal>, <literal>:add</literal>,
and <literal>:reload</literal> commands (<xref linkend="ghci-load-scope"/>).
</para></listitem>
<listitem><para>
@@ -702,8 +702,8 @@ Prelude>
<sect3 id="ghci-load-scope">
<title>The effect of <literal>:load</literal> on what is in scope</title>
<para>
- The <literal>:load</literal>, <literal>:add</literal>, and <literal>:reload</literal>
- commands (<xref linkend="loading-source-files"/>
+ The <literal>:load</literal>, <literal>:add</literal>, and <literal>:reload</literal>
+ commands (<xref linkend="loading-source-files"/>
and <xref linkend="ghci-compiled"/>) affect the top-level scope.
Let's start with the simple cases; when you start
GHCi the prompt looks like this:
@@ -830,7 +830,7 @@ Prelude System.IO Map>
<title>Controlling what is in scope with the <literal>:module</literal> command</title>
<para>Another way to manipulate the scope is to use the
- <literal>:module</literal> command, whose syntax is this:
+ <literal>:module</literal> command, whose syntax is this:
<screen>
:module <optional>+|-</optional> <optional>*</optional><replaceable>mod<subscript>1</subscript></replaceable> ... <optional>*</optional><replaceable>mod<subscript>n</subscript></replaceable>
@@ -881,7 +881,7 @@ Prelude System.IO Map>
<literal>:load</literal></title>
<para>It might seem that <literal>:module</literal>/<literal>import</literal> and
- <literal>:load</literal>/<literal>:add</literal>/<literal>:reload</literal>
+ <literal>:load</literal>/<literal>:add</literal>/<literal>:reload</literal>
do similar things: you can use both
to bring a module into scope. However, there is a very important
difference. GHCi is concerned with two sets of modules:</para>
@@ -907,7 +907,7 @@ Prelude System.IO Map>
</listitem>
</itemizedlist>
- <para>You can add a module to the scope (via <literal>:module</literal>
+ <para>You can add a module to the scope (via <literal>:module</literal>
or <literal>import</literal>)
only if either (a) it is loaded, or
(b) it is a module from a package that GHCi knows about.
@@ -2627,7 +2627,7 @@ T Int :: * -> *
<varlistentry>
<term>
- <literal>:load</literal> <optional><literal>*</literal></optional><replaceable>module</replaceable> ...
+ <literal>:load</literal><optional><literal>!</literal></optional> <optional><literal>*</literal></optional><replaceable>module</replaceable> ...
<indexterm><primary><literal>:load</literal></primary></indexterm>
</term>
<listitem>
@@ -2649,6 +2649,15 @@ T Int :: * -> *
byte-code. Using the <literal>*</literal> prefix forces a
module to be loaded as byte-code.</para>
+ <para>Adding the optional "<literal>!</literal>" turns type
+ errors into warnings while loading. This allows to use the
+ portions of the module that are correct, even if there are
+ type errors in some definitions. Effectively, the
+ "-fdefer-type-errors" flag is set before loading and unset
+ after loading if the flag has not already been set
+ before. See <xref linkend="defer-type-errors" /> for further
+ motivation and details.</para>
+
<para>After a <literal>:load</literal> command, the current
context is set to:</para>
@@ -2785,7 +2794,7 @@ bar
<varlistentry>
<term>
- <literal>:reload</literal>
+ <literal>:reload</literal><optional><literal>!</literal></optional>
<indexterm><primary><literal>:reload</literal></primary></indexterm>
</term>
<listitem>
@@ -2794,6 +2803,15 @@ bar
or any dependent module, has changed. Note that this may
entail loading new modules, or dropping modules which are no
longer indirectly required by the target.</para>
+
+ <para>Adding the optional "<literal>!</literal>" turns type
+ errors into warnings while loading. This allows to use the
+ portions of the module that are correct, even if there are
+ type errors in some definitions. Effectively, the
+ "-fdefer-type-errors" flag is set before loading and unset
+ after loading if the flag has not already been set
+ before. See <xref linkend="defer-type-errors" /> for further
+ motivation and details.</para>
</listitem>
</varlistentry>
@@ -3302,7 +3320,7 @@ Prelude> :set -fno-warn-incomplete-patterns -XNoMultiParamTypeClasses
<title>Setting options for interactive evaluation only</title>
<para>
- GHCi actually maintains <emphasis>two</emphasis> sets of options:
+ GHCi actually maintains <emphasis>two</emphasis> sets of options:
<itemizedlist>
<listitem><para>
The <emphasis>loading options</emphasis> apply when loading modules
@@ -3317,7 +3335,7 @@ The <literal>:set</literal> command modifies both, but there is
</para>
<para>
- It is often useful to change the interactive options,
+ It is often useful to change the interactive options,
without having that option apply to loaded modules
too. For example
<screen>