Rationalise GhcMode, HscTarget and GhcLink
[ghc-hetmet.git] / docs / users_guide / ghci.xml
index 749b4d6..03f4a3e 100644 (file)
@@ -18,7 +18,7 @@
   <indexterm><primary>FFI</primary><secondary>GHCi support</secondary></indexterm>
   <indexterm><primary>Foreign Function Interface</primary><secondary>GHCi support</secondary></indexterm>
 
-  <sect1>
+  <sect1 id="ghci-introduction">
     <title>Introduction to GHCi</title>
 
     <para>Let's start with an example GHCi session.  You can fire up
@@ -68,7 +68,7 @@ Prelude>
    :show bindings              show the current bindings made at the prompt
 
    :ctags [&lt;file&gt;]             create tags file for Vi (default: "tags")
-   :etags [&lt;file&gt;]             create tags file for Emacs (defauilt: "TAGS")
+   :etags [&lt;file&gt;]             create tags file for Emacs (default: "TAGS")
    :type &lt;expr&gt;                show the type of &lt;expr&gt;
    :kind &lt;type&gt;                show the kind of &lt;type&gt;
    :undef &lt;cmd&gt;                undefine user-defined command :&lt;cmd&gt;
@@ -106,7 +106,7 @@ Prelude>
     enter, GHCi will attempt to evaluate it.</para>
   </sect1>
 
-  <sect1>
+  <sect1 id="loading-source-files">
     <title>Loading source files</title>
 
     <para>Suppose we have the following Haskell source code, which we
@@ -363,7 +363,7 @@ Ok, modules loaded: A, B, C, D.
 
   </sect1>
 
-  <sect1>
+  <sect1 id="interactive-evaluation">
     <title>Interactive evaluation at the prompt</title>
 
     <para>When you type an expression at the prompt, GHCi immediately
@@ -747,24 +747,79 @@ it &lt;- <replaceable>e</replaceable>
     standard rules take each group of constraints <literal>(C1 a, C2 a, ..., Cn
     a)</literal> for each type variable <literal>a</literal>, and defaults the
     type variable if 
-       <itemizedlist>
-           <listitem><para> The type variable <literal>a</literal>
-       appears in no other constraints </para></listitem>
-           <listitem><para> All the classes <literal>Ci</literal> are standard.</para></listitem>
-           <listitem><para> At least one of the classes <literal>Ci</literal> is
-           numeric.</para></listitem>
-      </itemizedlist>
-   At the GHCi prompt, the second and third rules are relaxed as follows
-   (differences italicised):
-       <itemizedlist>
-           <listitem><para> <emphasis>All</emphasis> of the classes
-           <literal>Ci</literal> are single-parameter type classes.</para></listitem>
-           <listitem><para> At least one of the classes <literal>Ci</literal> is
-           numeric, <emphasis>or is <literal>Show</literal>, 
-               <literal>Eq</literal>, or <literal>Ord</literal></emphasis>.</para></listitem>
-      </itemizedlist>
-   The same type-default behaviour can be enabled in an ordinary Haskell
-   module, using the flag <literal>-fextended-default-rules</literal>.
+    <orderedlist>
+        <listitem>
+            <para>
+                The type variable <literal>a</literal> appears in no
+                other constraints
+            </para>
+        </listitem>
+        <listitem>
+            <para>
+                All the classes <literal>Ci</literal> are standard.
+            </para>
+        </listitem>
+        <listitem>
+            <para>
+                At least one of the classes <literal>Ci</literal> is
+                numeric.
+            </para>
+        </listitem>
+    </orderedlist>
+    At the GHCi prompt, or with GHC if the
+    <literal>-fextended-default-rules</literal> flag is given,
+    the following additional differences apply:
+    <itemizedlist>
+        <listitem>
+            <para>
+                Rule 2 above is relaxed thus:
+                <emphasis>All</emphasis> of the classes
+                <literal>Ci</literal> are single-parameter type classes.
+            </para>
+        </listitem>
+        <listitem>
+            <para>
+                Rule 3 above is relaxed this:
+                At least one of the classes <literal>Ci</literal> is
+                numeric, <emphasis>or is <literal>Show</literal>,
+                <literal>Eq</literal>, or
+                <literal>Ord</literal></emphasis>.
+            </para>
+        </listitem>
+        <listitem>
+            <para>
+                The unit type <literal>()</literal> is added to the
+                start of the standard list of types which are tried when
+                doing type defaulting.
+            </para>
+        </listitem>
+    </itemizedlist>
+    The last point means that, for example, this program:
+<programlisting>
+main :: IO ()
+main = print def
+
+instance Num ()
+
+def :: (Num a, Enum a) => a
+def = toEnum 0
+</programlisting>
+    prints <literal>()</literal> rather than <literal>0</literal> as the
+    type is defaulted to <literal>()</literal> rather than
+    <literal>Integer</literal>.
+   </para>
+   <para>
+    The motivation for the change is that it means <literal>IO a</literal>
+    actions default to <literal>IO ()</literal>, which in turn means that
+    ghci won't try to print a result when running them. This is
+    particularly important for <literal>printf</literal>, which has an
+    instance that returns <literal>IO a</literal>.
+    However, it is only able to return
+    <literal>undefined</literal>
+    (the reason for the instance having this type is to not require
+    extensions to the class system), so if the type defaults to
+    <literal>Integer</literal> then ghci gives an error when running a
+    printf.
    </para>
     </sect2>
   </sect1>
@@ -906,6 +961,21 @@ $ ghci -lm
 
       <varlistentry>
        <term>
+          <literal>:breakpoint</literal> <replaceable>list|add|continue|del|stop|step</replaceable> ...
+          <indexterm><primary><literal>:breakpoint</literal></primary></indexterm>
+        </term>
+       <listitem>
+         <para>Permits to add, delete or list the breakpoints in a debugging session.
+         In order to make this command available, the 
+         <literal>-fdebugging</literal> flag must be active. The easiest way is to launch
+         GHCi with the <literal>-fdebugging</literal> option. For more
+         details on how the debugger works, see <xref linkend="ghci-debugger"/>.
+         </para>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term>
           <literal>:browse</literal> <optional><literal>*</literal></optional><replaceable>module</replaceable> ...
           <indexterm><primary><literal>:browse</literal></primary></indexterm>
         </term>
@@ -948,6 +1018,15 @@ $ ghci -lm
 
       <varlistentry>
        <term>
+          <literal>:continue</literal> 
+          <indexterm><primary><literal>:continue</literal></primary></indexterm>
+        </term>
+       <listitem><para>Shortcut to <literal>:breakpoint continue</literal></para>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term>
           <literal>:def</literal> <replaceable>name</replaceable> <replaceable>expr</replaceable>
           <indexterm><primary><literal>:def</literal></primary></indexterm>
         </term>
@@ -1147,6 +1226,50 @@ Prelude> :main foo bar
 
       <varlistentry>
        <term>
+          <literal>:print </literal> <replaceable>names</replaceable> ...
+          <indexterm><primary><literal>:print</literal></primary></indexterm>
+        </term>
+       <listitem>
+         <para> Prints a semievaluated value without forcing its evaluation. 
+         <literal>:print </literal> works just like <literal>:sprint</literal> but additionally, 
+           <literal>:print</literal> binds the unevaluated parts -called 
+          <quote>suspensions</quote>-
+         to names which you can play with. For example:
+<screen>
+Prelude> let li = map Just [1..5]
+Prelude> :sp li
+li - _
+Prelude> :p li
+li - (_t1::[Maybe Integer])
+Prelude> head li
+Just 1
+Prelude> :sp li
+li - [Just 1 | _]
+Prelude> :p li
+li - [Just 1 | (_t2::[Maybe Integer])]
+Prelude> last li
+Just 5
+Prelude> :sp li
+li - [Just 1,_,_,_,Just 5]
+Prelude> :p li
+li - [Just 1,(_t3::Maybe Integer),(_t4::Maybe Integer),(_t5::Maybe Integer),Just 4]
+Prelude> _t4
+Just 3
+Prelude> :p li
+li - [Just 1,(_t6::Maybe Integer),Just 3,(_t7::Maybe Integer),Just 4]
+</screen>
+         The example uses <literal>:print</literal> and  <literal>:sprint</literal> 
+        to help us observe how the <literal>li</literal> variable is evaluated progressively as we operate
+         with it. Note for instance how <quote>last</quote> traverses all the elements of
+        the list to compute its result, but without evaluating the individual elements.</para>
+           <para>Finally note that the Prolog convention of [head | tail] is used by 
+        <literal>:sprint</literal> to display unevaluated lists.
+         </para>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term>
           <literal>:quit</literal>
           <indexterm><primary><literal>:quit</literal></primary></indexterm>
         </term>
@@ -1250,7 +1373,36 @@ Prelude> :main foo bar
          <para>Show the list of modules currently load.</para>
        </listitem>
       </varlistentry>
-
+      <varlistentry>
+       <term>
+          <literal>:sprint</literal>
+          <indexterm><primary><literal>:sprint</literal></primary></indexterm>
+        </term>
+       <listitem>
+         <para>Prints a semievaluated value without forcing its evaluation. 
+         <literal>:sprint</literal> and its sibling <literal>:print</literal> 
+         are very useful to observe how lazy evaluation works in your code. For example:
+<screen>
+Prelude> let li = map Just [1..5]
+Prelude> :sp li
+li - _
+Prelude> head li
+Just 1
+Prelude> :sp li
+li - [Just 1 | _]
+Prelude> last li
+Just 5
+Prelude> :sp li
+li - [Just 1,_,_,_,Just 5]
+</screen>
+         The example uses <literal>:sprint</literal> to help us observe how the <literal>li</literal> variable is evaluated progressively as we operate
+         with it. Note for instance how <quote>last</quote> traverses all the elements of
+        the list to compute its result, but without evaluating the individual elements.</para>
+           <para>Finally note that the Prolog convention of [head | tail] is used by 
+        <literal>:sprint</literal> to display unevaluated lists.
+         </para>
+       </listitem>
+      </varlistentry>
       <varlistentry>
        <term>
          <literal>:ctags</literal> <optional><replaceable>filename</replaceable></optional>
@@ -1448,7 +1600,296 @@ Prelude> :set -fno-glasgow-exts
       <indexterm><primary>static</primary><secondary>options</secondary></indexterm>
     </sect2>
   </sect1>
+  <sect1 id="ghci-debugger">
+    <title>The GHCi debugger</title>
+    <indexterm><primary>debugger</primary></indexterm>
+    <para>GHCi embeds an utility debugger with a very basic set of operations. The debugger
+          is always available in ghci, you do not need to do anything to activate it. </para>
+    <para>The following conditions must hold before a module can be debugged in GHCi:
+      <itemizedlist>
+         <listitem>
+          <para>The module must have been loaded interpreted, i.e. not loaded from an <filename>.o</filename> file compiled by ghc </para>
+        </listitem>
+        <listitem>
+          <para>The module must have been loaded with the <literal>-fdebugging</literal> flag
+          </para></listitem>
+       </itemizedlist></para>
+    <sect2><title>Using the debugger</title>
+    <para>The debugger allows the insertion of breakpoints at specific locations in the source code. These locations are governed by event sites, and not by line as in traditional debuggers such as gdb. </para> <para>
+      Once a breakpointed event is hit, the debugger stops the execution and you can examine the local variables in scope
+      in the context of the event, as well as evaluate arbitrary Haskell expressions in
+      a special interactive prompt. </para><para>
+      
+     When you are done you issue the <literal>:continue</literal> 
+      command to leave the breakpoint and let the execution go on. 
+     Note that not all the GHCi commands are supported in a breakpoint. 
+
+    </para>
+    <sidebar><title>Events</title><?dbfo float-type="left"?>
+    <para> Events are the places in source code where you can set a breakpoint.
+<programlisting>
+qsort [] = <co id="name-binding-co"/> []
+qsort (x:xs) = 
+   <coref linkend="name-binding-co"/> let left  = <coref linkend="name-binding-co"/> filter (\y -> <co id="lambda-co"/> y &lt; x) xs
+           right = <coref linkend="name-binding-co"/> case filter (\y -> <coref linkend="lambda-co"/> y &gt; x) xs of 
+                              right_val -> <co id="case-co"/> right_val
+    in <co id="let-co"/> qsort left ++ [x] ++ qsort right
+main = <coref linkend="name-binding-co"/> do { 
+   arg &lt;- <coref linkend="name-binding-co"/> getLine ;
+   let num = <coref linkend="name-binding-co"/> read arg :: [Int] ;
+ <co id="stmts-co"/> print (qsort num) ;
+ <coref linkend="stmts-co"/> putStrLn "GoodBye!" }
+</programlisting>
+     The GHCi debugger recognizes the following event types:
+    <calloutlist>
+      <callout arearefs="name-binding-co" id="name-binding">
+       <para>Function definition and local bindings in let/where</para>
+    </callout>
+    <callout arearefs="lambda-co" id="lambda">
+        <para>Lambda expression entry point</para>
+    </callout>
+    <callout arearefs="let-co" id="let">
+      <para>Let expression body</para>
+    </callout>
+    <callout arearefs="case-co" id="case">
+      <para>Case alternative body</para>
+    </callout>
+    <callout arearefs="stmts-co" id="stmts">
+      <para>do notation statements</para>
+    </callout>
+    </calloutlist></para>
+    <para>In reality however, ghci eliminates some redundant event sites. 
+    For instance, sites with two co-located breakpoint events are coalesced into a single one,
+    and sites with no bindings in scope are assumed to be uninteresting and no breakpoint can be set in them.</para>
+    </sidebar>
+
+<para>
+      You don't need to do anything special in order to start the debugging session.
+      Simply use ghci to evaluate your Haskell expressions and whenever a breakpoint
+      is hit, the debugger will enter the stage:
+<programlisting>
+*main:Main> :break add Main 2
+Breakpoint set at (2,15)
 
+*main:Main> qsort [10,9..1]
+Local bindings in scope:
+  x :: a, xs :: [a], left :: [a], right :: [a]
+
+qsort2.hs:2:15-46>   
+</programlisting>
+      What is happening here is that GHCi has interrupted the evaluation of 
+      <literal>qsort</literal> at the breakpoint set in line 2, as the prompt indicates.
+      At this point you can freely explore the contents of the bindings in scope,
+      but with two catches. </para><para>
+      First, take into account that due to the lazy nature of Haskell, some of
+      these bindings may be unevaluated, and that exploring their contents may 
+      trigger a computation. </para><para>
+      Second: look at the types of the things in scope.
+      GHCi has left its types parameterised by a variable!
+      Look at the type of <literal>qsort</literal>, which is 
+      polymorphic on the type of its argument. It does not 
+      tell us really what the types of <literal>x</literal> and <literal>xs</literal> can be. 
+      In general, polymorphic programs deal with polymorphic values,
+      and this means that some of the bindings available in a breakpoint site
+      will be parametrically typed.
+      </para><para>
+      So, what can we do with a value without concrete type? Very few interesting
+      things. The <literal>:print</literal> command in ghci allows you to 
+      explore its contents and see if it is evaluated or not. 
+      This is useful because you cannot just type <literal>x</literal> in the 
+      prompt and expect GHCi to return you its value. Perhaps you know for 
+      sure that 
+      <literal>x</literal> is of type <literal>Int</literal>, which is an instance of 
+      <literal>Show</literal>, but GHCi does not have this information. 
+      <literal>:print</literal> however is fine, because it does not need to know the 
+      type to do its work. </para>
+      <para> Let's go on with the debugging session of the <literal>qsort</literal>
+      example:
+<example id="debuggingEx"><title>A short debugging session</title>
+<programlisting>
+qsort2.hs:2:15-46> x
+This is an untyped, unevaluated computation. You can use seq to 
+force its evaluation and then :print to recover its type <co id="seq1"/>
+qsort2.hs:2:15-46> seq x ()  <co id="seq2"/>
+() 
+qsort2.hs:2:15-46> x <co id="seq3"/>
+This is an untyped, unevaluated computation. You can use seq to 
+force its evaluation and then :print to recover its type
+
+qsort2.hs:2:15-46> :t x
+x :: GHC.Base.Unknown
+qsort2.hs:2:15-46> :p x <co id="seq4"/>
+x - 10
+qsort2.hs:2:15-46> :t x <co id="seq5"/>
+x :: Int
+</programlisting>
+</example>
+      <calloutlist>
+       <callout arearefs="seq1">
+         <para>GHCi reminds us that this value is untyped, and instructs us to force its evaluation </para>
+       </callout>
+       <callout arearefs="seq2">
+         <para>This line forces the evaluation of <literal>x</literal> </para>
+       </callout>
+       <callout arearefs="seq3">
+         <para>Even though x has been evaluated, we cannot simply use its name to see its value! 
+         This is a bit counterintuitive, but currently in GHCi the type of a binding
+         cannot be a type variable <literal>a</literal>. 
+         Thus, the binding <literal>x</literal> gets assigned the concrete type Unknown.</para>
+       </callout>
+       <callout arearefs="seq4">
+         <para>We can explore <literal>x</literal> using the <literal>:print</literal> 
+         command, which does find out that <literal>x</literal> is of type Int and prints
+         its value accordingly.</para>
+       </callout>
+       <callout arearefs="seq5">
+          <para><literal>:print</literal> also updates the type of <literal>x</literal> with
+          the most concrete type information available.</para>
+       </callout>
+      </calloutlist>
+      The example shows the standard way to proceeed with polymorphic values in a breakpoint. 
+      </para>
+    </sect2>
+    <sect2><title>Commands</title>
+    <para>Breakpoints can be set in several ways using the <literal>:breakpoint</literal> command. Note that you can take advantage of the command abbreviation feature of GHCi and use simply <literal>:bre</literal> to save quite a few keystrokes.
+<variablelist>
+<varlistentry>
+  <term>
+    <literal>:breakpoint add <replaceable>module</replaceable> <replaceable>line</replaceable></literal>
+  </term>
+  <listitem><para>
+    Adds a breakpoint at the first event found at line <literal>line</literal> in <literal>module</literal>, if any.
+  </para></listitem>
+</varlistentry>
+<varlistentry>
+  <term>
+    <literal>:breakpoint add <replaceable>module</replaceable> <replaceable>line</replaceable> <replaceable>column</replaceable></literal>
+  </term>
+  <listitem><para>
+    Adds a breakpoint at the first event found after column <literal>column</literal>
+    at line <literal>line</literal> in <literal>module</literal>, if any.
+  </para></listitem>
+</varlistentry>
+
+<varlistentry>
+  <term>
+    <literal>:breakpoint continue</literal>
+  </term>
+  <listitem><para>
+   When at a breakpoint, continue execution up to the next breakpoint
+   or end of evaluation.
+  </para></listitem>
+</varlistentry>
+
+<varlistentry>
+  <term>
+    <literal>:continue</literal>
+  </term>
+  <listitem><para>
+      Shortcut for <literal>:breakpoint continue</literal>
+  </para></listitem>
+</varlistentry>
+
+<varlistentry>
+  <term>
+    <literal>:breakpoint list</literal>
+  </term>
+  <listitem><para>
+    Lists the currently set up breakpoints.
+  </para></listitem>
+</varlistentry>
+<varlistentry>
+  <term>
+    <literal>:breakpoint del <replaceable>num</replaceable></literal>
+  </term>
+  <listitem><para>
+    Deletes the breakpoint at position <literal>num</literal> in the list of
+    breakpoints shown by <literal>:breakpoint list</literal>.
+  </para></listitem>
+</varlistentry>
+<varlistentry>
+  <term>
+    <literal>:breakpoint del <replaceable>module</replaceable> <replaceable>line</replaceable></literal>
+  </term>
+  <listitem><para>
+  Dels the breakpoint at line <literal>line</literal> in <literal>module</literal>, if any.
+  </para></listitem>
+</varlistentry>
+<varlistentry>
+  <term>
+    <literal>:breakpoint del <replaceable>module</replaceable> <replaceable>line</replaceable><replaceable>col</replaceable> </literal>
+  </term>
+  <listitem><para>
+    Deletes the first breakpoint found after column <literal>column</literal>
+    at line <literal>line</literal> in <literal>module</literal>, if any.
+  </para></listitem>
+</varlistentry>
+<varlistentry>
+  <term>
+    <literal>:breakpoint stop </literal>
+  </term>
+  <listitem><para>
+    Stop the program being executed. This interrupts a debugging session
+    and returns to the top level.
+  </para></listitem>
+</varlistentry>
+</variablelist></para>
+    </sect2>
+    <sect2><title>Limitations</title>
+     <para>
+      <itemizedlist>
+       <listitem><para>
+         Implicit parameters (see <xref linkend="implicit-parameters"/>) are only available 
+         at the scope of a breakpoint if there is a explicit type signature.
+       </para></listitem>
+      </itemizedlist>
+      <itemizedlist>
+       <listitem><para>
+         Modules compiled by GHCi under the <literal>-fdebugging
+       </literal> flag  will perform slower: the debugging mode introduces some overhead.
+      Modules compiled to object code by ghc are not affected.
+       </para></listitem>
+      </itemizedlist>      
+     </para>
+    </sect2>
+    <sect2><title>Tips</title>
+      <variablelist>
+       <varlistentry><term>* Use PRAGMAs to fine tune which modules are loaded under debugging mode</term>
+         <listitem>
+           <programlisting>{-# OPTIONS_GHC -fdebugging #-}</programlisting>
+         </listitem>
+       </varlistentry>
+       <varlistentry> <term>* Repeated use of <literal>seq</literal> and 
+           <literal>:print</literal> may be necessary to observe unevaluated
+           untyped bindings</term> 
+         <listitem><para>see <xref linkend="debuggingEx"/> 
+         </para></listitem>
+       </varlistentry>
+       <varlistentry> <term> * <literal>GHC.Exts.unsafeCoerce</literal> can help if you are positive about the type of a binding</term> 
+         <listitem><para><programlisting>
+type MyLongType a = [Maybe [Maybe a]]
+
+main:Main> :m +GHC.Exts
+main:Main> main
+Local bindings in scope:
+  x :: a
+Main.hs:15> let x' = unsafeCoerce x :: MyLongType Bool
+Main.hs:15> x'
+[Just [Just False, Just True]]
+         </programlisting>
+          Note that a wrong coercion will likely result in your debugging session being interrupted by a segmentation fault 
+         </para></listitem>
+       </varlistentry>
+       <varlistentry> <term> * The undocumented (and unsupported) &colon;force command </term>
+         <listitem><para> 
+             equivalent to <literal> :print</literal> with automatic 
+             <literal>seq</literal> forcing, 
+             may prove useful to replace sequences of <literal>seq</literal> and 
+             <literal>&colon;print</literal> in some situations. 
+         </para></listitem>
+       </varlistentry> 
+    </variablelist>
+    </sect2></sect1>
   <sect1 id="ghci-dot-files">
     <title>The <filename>.ghci</filename> file</title>
     <indexterm><primary><filename>.ghci</filename></primary><secondary>file</secondary>
@@ -1511,7 +1952,33 @@ Prelude> :set -fno-glasgow-exts
 
   </sect1>
 
-  <sect1>
+  <sect1 id="ghci-obj">
+    <title>Compiling to object code inside GHCi</title>
+
+    <para>By default, GHCi compiles Haskell source code into byte-code
+    that is interpreted by the runtime system.  GHCi can also compile
+    Haskell code to object code: to turn on this feature, use the
+    <option>-fobject-code</option> flag either on the command line or
+    with <literal>:set</literal> (the option
+    <option>-fbyte-code</option> restores byte-code compilation
+    again).  Compiling to object code takes longer, but typically the
+    code will execute 10-20 times faster than byte-code.</para>
+
+    <para>Compiling to object code inside GHCi is particularly useful
+    if you are developing a compiled application, because the
+    <literal>:reload</literal> command typically runs much faster than
+    restarting GHC with <option>--make</option> from the command-line,
+    because all the interface files are already cached in
+    memory.</para>
+
+    <para>There are disadvantages to compiling to object-code: you
+    can't set breakpoints in object-code modules, for example.  Only
+    the exports of an object-code module will be visible in GHCi,
+    rather than all top-level bindings as in interpreted
+    modules.</para>
+  </sect1>
+
+  <sect1 id="ghci-faq">
     <title>FAQ and Things To Watch Out For</title>
     
     <variablelist>
@@ -1556,10 +2023,9 @@ Prelude> :set -fno-glasgow-exts
        <term>Concurrent threads don't carry on running when GHCi is
         waiting for input.</term>
        <listitem>
-         <para>No, they don't.  This is because the Haskell binding
-         to the GNU readline library doesn't support reading from the
-         terminal in a non-blocking way, which is required to work
-         properly with GHC's concurrency model.</para>
+         <para>This should work, as long as your GHCi was built with
+         the <option>-threaded</option> switch, which is the default.
+         Consult whoever supplied your GHCi installation.</para>
        </listitem>
       </varlistentry>
 
@@ -1586,6 +2052,13 @@ Prelude> :set -fno-glasgow-exts
        </listitem>
       </varlistentry>
 
+      <varlistentry>
+       <term>I can't use Control-C to interrupt computations in
+          GHCi on Windows.</term>
+        <listitem>
+          <para>See <xref linkend="ghci-windows"/></para>
+        </listitem>
+      </varlistentry>
     </variablelist>
   </sect1>