Fix a typo
[ghc-hetmet.git] / docs / users_guide / ghci.xml
index 94d352b..5f38b37 100644 (file)
@@ -906,7 +906,7 @@ $ ghci -lm
 
       <varlistentry>
        <term>
-          <literal>:breakpoint</literal> <replaceable>list|add|del|stop|step</replaceable> ...
+          <literal>:breakpoint</literal> <replaceable>list|add|continue|del|stop|step</replaceable> ...
           <indexterm><primary><literal>:breakpoint</literal></primary></indexterm>
         </term>
        <listitem>
@@ -963,6 +963,15 @@ $ ghci -lm
 
       <varlistentry>
        <term>
+          <literal>:continue</literal> 
+          <indexterm><primary><literal>:continue</literal></primary></indexterm>
+        </term>
+       <listitem> Shortcut to <literal>:breakpoint continue </literal>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term>
           <literal>:def</literal> <replaceable>name</replaceable> <replaceable>expr</replaceable>
           <indexterm><primary><literal>:def</literal></primary></indexterm>
         </term>
@@ -1551,12 +1560,12 @@ Prelude> :set -fno-glasgow-exts
           </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 goberned by event sites, and not by line as in traditional debuggers such as gdb. </para> <para>
+    <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>:quit</literal> 
+     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. 
 
@@ -1641,6 +1650,7 @@ qsort2.hs:2:15-46>
       type to do its work. </para>
       <para> Let's go on with the debugging session of the <code>qsort</code>
       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 
@@ -1658,7 +1668,7 @@ 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>
@@ -1705,6 +1715,26 @@ x :: Int
     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>
@@ -1767,7 +1797,44 @@ x :: Int
       </itemizedlist>      
      </para>
     </sect2>
-    </sect1>
+    <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 <code>seq</code> and 
+           <literal>:print</literal> may be necessary to observe unevaluated
+           untyped bindings</term> 
+         <listitem><para>see <xref linkend="debuggingEx"/> 
+         </para></listitem>
+       </varlistentry>
+       <varlistentry> <term> * <code>GHC.Exts.unsafeCoerce</code> 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 
+             <code>seq</code> forcing, 
+             may prove useful to replace sequences of <code>seq</code> 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>