ghci doc tweaks
[ghc-hetmet.git] / docs / users_guide / ghci.xml
index b27781c..9810dce 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>.
-  GHCi also includes an interactive debugger (see <xref linkend="ghci-debugger"/>)..</para>
+  GHCi also includes an interactive debugger (see <xref linkend="ghci-debugger"/>).</para>
 
   <sect1 id="ghci-introduction">
     <title>Introduction to GHCi</title>
 
 <screen>
 $ ghci
-   ___         ___ _
-  / _ \ /\  /\/ __(_)
- / /_\// /_/ / /  | |      GHC Interactive, version 6.6, for Haskell 98.
-/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
-\____/\/ /_/\____/|_|      Type :? for help.
-
+GHCi, version 6.8.1: http://www.haskell.org/ghc/  :? for help
 Loading package base ... linking ... done.
 Prelude> 
 </screen>
 
     <para>There may be a short pause while GHCi loads the prelude and
-    standard libraries, after which the prompt is shown.  If we follow
-    the instructions and type <literal>:?</literal> for help, we
-    get:</para>
-
-<screen>
- Commands available from the prompt:
-
-   &lt;stmt&gt;                      evaluate/run &lt;stmt&gt;
-   :add &lt;filename&gt; ...         add module(s) to the current target set
-   :browse [*]&lt;module&gt;         display the names defined by &lt;module&gt;
-   :cd &lt;dir&gt;                   change directory to &lt;dir&gt;
-   :def &lt;cmd&gt; &lt;expr&gt;           define a command :&lt;cmd&gt;
-   :edit &lt;file&gt;                edit file
-   :edit                       edit last module
-   :help, :?                   display this list of commands
-   :info [&lt;name&gt; ...]          display information about the given names
-   :load &lt;filename&gt; ...        load module(s) and their dependents
-   :module [+/-] [*]&lt;mod&gt; ...  set the context for expression evaluation
-   :main [&lt;arguments&gt; ...]     run the main function with the given arguments
-   :reload                     reload the current module set
-
-   :set &lt;option&gt; ...           set options
-   :set args &lt;arg&gt; ...         set the arguments returned by System.getArgs
-   :set prog &lt;progname&gt;        set the value returned by System.getProgName
-   :set prompt &lt;prompt&gt;        set the prompt used in GHCi
-   :set editor &lt;cmd&gt;        set the command used for :edit
-
-   :show modules               show the currently loaded modules
-   :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 (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;
-   :unset &lt;option&gt; ...         unset options
-   :quit                       exit GHCi
-   :!&lt;command&gt;                 run the shell command &lt;command&gt;
-
- Options for ':set' and ':unset':
-
-    +r            revert top-level expressions after each evaluation
-    +s            print timing/memory stats after each evaluation
-    +t            print type after evaluation
-    -&lt;flags&gt;      most GHC command line flags can also be set here
-                         (eg. -v2, -fglasgow-exts, etc.)
-</screen>
+    standard libraries, after which the prompt is shown. As the banner
+    says, you can type <literal>:?</literal> to see the list of commands
+    available, and a half line description of each of them.</para>
 
     <para>We'll explain most of these commands as we go along.  For
     Hugs users: many things work the same as in Hugs, so you should be
@@ -268,19 +219,17 @@ Ok, modules loaded: Main.
 <screen>
 Prelude> :! ghc -c D.hs
 Prelude> :load A
-Skipping  D                ( D.hs, D.o )
-Compiling C                ( C.hs, interpreted )
 Compiling B                ( B.hs, interpreted )
+Compiling C                ( C.hs, interpreted )
 Compiling A                ( A.hs, interpreted )
 Ok, modules loaded: A, B, C, D.
 *Main>
 </screen>
 
-    <para>In the messages from the compiler, we see that it skipped D,
-    and used the object file <filename>D.o</filename>.  The message
-    <literal>Skipping</literal> <replaceable>module</replaceable>
-    indicates that compilation for <replaceable>module</replaceable>
-    isn't necessary, because the source and everything it depends on
+    <para>In the messages from the compiler, we see that there is no line
+    for <literal>D</literal>. This is because
+    it isn't necessary to compile <literal>D</literal>,
+    because the source and everything it depends on
     is unchanged since the last compilation.</para>
 
     <para>At any time you can use the command 
@@ -296,7 +245,7 @@ B                ( B.hs, interpreted )
 A                ( A.hs, interpreted )
 *Main></screen>
 
-    <para>If we now modify the source of D (or pretend to: using Unix
+    <para>If we now modify the source of D (or pretend to: using the Unix
     command <literal>touch</literal> on the source file is handy for
     this), the compiler will no longer be able to use the object file,
     because it might be out of date:</para>
@@ -305,9 +254,6 @@ A                ( A.hs, interpreted )
 *Main> :! touch D.hs
 *Main> :reload
 Compiling D                ( D.hs, interpreted )
-Skipping  C                ( C.hs, interpreted )
-Skipping  B                ( B.hs, interpreted )
-Skipping  A                ( A.hs, interpreted )
 Ok, modules loaded: A, B, C, D.
 *Main> 
 </screen>
@@ -323,8 +269,8 @@ Ok, modules loaded: A, B, C, D.
 *Main> :! ghc -c C.hs
 *Main> :load A
 Compiling D                ( D.hs, interpreted )
-Compiling C                ( C.hs, interpreted )
 Compiling B                ( B.hs, interpreted )
+Compiling C                ( C.hs, interpreted )
 Compiling A                ( A.hs, interpreted )
 Ok, modules loaded: A, B, C, D.
 </screen>
@@ -347,8 +293,6 @@ Ok, modules loaded: A, B, C, D.
 
 <screen>
 *Main> :load A
-Skipping  D                ( D.hs, D.o )
-Skipping  C                ( C.hs, C.o )
 Compiling B                ( B.hs, interpreted )
 Compiling A                ( A.hs, interpreted )
 Ok, modules loaded: A, B, C, D.
@@ -359,7 +303,7 @@ Ok, modules loaded: A, B, C, D.
     when working on a large program is to occasionally run
     <literal>ghc &ndash;&ndash;make</literal> to compile the whole project (say
     before you go for lunch :-), then continue working in the
-    interpreter.  As you modify code, the new modules will be
+    interpreter.  As you modify code, the changed modules will be
     interpreted, but the rest of the project will remain
     compiled.</para>
 
@@ -620,7 +564,7 @@ Prelude IO>
       <para>
         Hint: GHCi will tab-complete names that are in scope; for
         example, if you run GHCi and type <literal>J&lt;tab&gt;</literal>
-        then GHCi will expand it to <literal>Just </literal>.
+        then GHCi will expand it to &ldquo;<literal>Just </literal>&rdquo;.
       </para>
 
       <sect3>
@@ -771,7 +715,7 @@ it &lt;- <replaceable>e</replaceable>
         </listitem>
     </orderedlist>
     At the GHCi prompt, or with GHC if the
-    <literal>-fextended-default-rules</literal> flag is given,
+    <literal>-XExtendedDefaultRules</literal> flag is given,
     the following additional differences apply:
     <itemizedlist>
         <listitem>
@@ -820,8 +764,8 @@ def = toEnum 0
     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
+    (the reason for the instance having this type is so that printf
+    doesn't 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>