Fixed spelling error in compiler/ghci/InteractiveUI.hs and docs/users_guide/ghci.xml
[ghc-hetmet.git] / docs / users_guide / ghci.xml
index 9ec07c3..f9efe34 100644 (file)
@@ -49,6 +49,8 @@ Prelude>
    :browse [*]<module>         display the names defined by <module>
    :cd <dir>                   change directory to <dir>
    :def <cmd> <expr>           define a command :<cmd>
+   :edit <file>                edit file
+   :edit                       edit last module
    :help, :?                   display this list of commands
    :info [<name> ...]          display information about the given names
    :load <filename> ...        load module(s) and their dependents
@@ -60,12 +62,13 @@ Prelude>
    :set args <arg> ...         set the arguments returned by System.getArgs
    :set prog <progname>        set the value returned by System.getProgName
    :set prompt <prompt>        set the prompt used in GHCi
+   :set editor <cmd>        set the command used for :edit
 
    :show modules               show the currently loaded modules
    :show bindings              show the current bindings made at the prompt
 
    :ctags [<file>]             create tags file for Vi (default: "tags")
-   :etags [<file>]             create tags file for Emacs (defauilt: "TAGS")
+   :etags [<file>]             create tags file for Emacs (default: "TAGS")
    :type <expr>                show the type of <expr>
    :kind <type>                show the kind of <type>
    :undef <cmd>                undefine user-defined command :<cmd>
@@ -402,7 +405,7 @@ hello
 </screen>
 </para></sect2>
 
-    <sect2>
+    <sect2 id="ghci-stmts">
       <title>Using <literal>do-</literal>notation at the prompt</title>
       <indexterm><primary>do-notation</primary><secondary>in GHCi</secondary></indexterm>
       <indexterm><primary>statements</primary><secondary>in GHCi</secondary></indexterm>
@@ -444,7 +447,13 @@ Prelude>
              <literal>Show</literal></para>
          </listitem>
        </itemizedlist>
-      </para>
+      The automatic printing of binding results can be supressed with
+      <option>:set -fno-print-bind-result</option> (this does not
+      supress printing the result of non-binding statements).
+      <indexterm><primary><option>-fno-print-bind-result</option></primary></indexterm><indexterm><primary><option>-fprint-bind-result</option></primary></indexterm>.
+      You might want to do this to prevent the result of binding
+      statements from being fully evaluated by the act of printing
+      them, for example.</para>
 
       <para>Of course, you can also bind normal non-IO expressions
       using the <literal>let</literal>-statement:</para>
@@ -1007,6 +1016,22 @@ Prelude> :. cmds.ghci
 
       <varlistentry>
        <term>
+          <literal>:edit <optional><replaceable>file</replaceable></optional></literal>
+          <indexterm><primary><literal>:edit</literal></primary></indexterm>
+        </term>
+       <listitem>
+         <para>Opens an editor to edit the file
+         <replaceable>file</replaceable>, or the most recently loaded
+         module if <replaceable>file</replaceable> is omitted.  The
+         editor to invoke is taken from the <literal>EDITOR</literal>
+         environment variable, or a default editor on your system if
+         <literal>EDITOR</literal> is not set.  You can change the
+         editor using <literal>:set editor</literal>.</para>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term>
           <literal>:help</literal>
           <indexterm><primary><literal>:help</literal></primary></indexterm>
         </term>
@@ -1172,6 +1197,16 @@ Prelude> :main foo bar
 
       <varlistentry>
        <term>
+           <literal>:set</literal> <literal>editor</literal> <replaceable>cmd</replaceable>
+        </term>
+       <listitem>
+         <para>Sets the command used by <literal>:edit</literal> to
+         <replaceable>cmd</replaceable>.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term>
            <literal>:set</literal> <literal>prog</literal> <replaceable>prog</replaceable>
            <indexterm><primary><literal>:set prog</literal></primary></indexterm>
         </term>