[project @ 2002-11-19 15:57:10 by simonpj]
[ghc-hetmet.git] / ghc / docs / users_guide / ghci.sgml
index 0919b20..0ba4d8d 100644 (file)
@@ -44,36 +44,36 @@ Prelude>
 <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;
+   &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;
    :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
+   :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
    :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 &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
 
    :show modules              show the currently loaded modules
    :show bindings             show the current bindings made at the prompt
 
-   :type %lt;expr&gt;               show the type of %lt;expr&gt;
-   :undef %lt;cmd&gt;               undefine user-defined command :%lt;cmd&gt;
-   :unset %lt;option&gt; ...        unset options
+   :type &lt;expr&gt;               show the type of &lt;expr&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;
+   :!&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
+    -&lt;flags&gt;           most GHC command line flags can also be set here
                          (eg. -v2, -fglasgow-exts, etc.)
 </screen>
 
@@ -102,8 +102,7 @@ Prelude>
     <title>Loading source files</title>
 
     <para>Suppose we have the following Haskell source code, which we
-    place in a file <filename>Main.hs</filename> in the current
-    directory:</para>
+    place in a file <filename>Main.hs</filename>:</para>
 
 <programlisting>
 main = print (fac 20)
@@ -112,6 +111,24 @@ fac 0 = 1
 fac n = n * fac (n-1)
 </programlisting>
 
+    <para>You can save <filename>Main.hs</filename> anywhere you like,
+    but if you save it somewhere other than the current
+    directory<footnote><para>If you started up GHCi from the command
+    line then GHCi's current directory is the same as the current
+    directory of the shell from which it was started.  If you started
+    GHCi from the &ldquo;Start&rdquo; menu in Windows, then the
+    current directory is probably something like
+    <filename>C:\Documents and Settings\<replaceable>user
+    name</replaceable></filename>.</para> </footnote> then we will
+    need to change to the right directory in GHCi:</para>
+
+<screen>
+Prelude> :cd <replaceable>dir</replaceable>
+</screen>
+
+    <para>where <replaceable>dir</replaceable> is the directory (or
+    folder) in which you saved <filename>Main.hs</filename>.</para>
+
     <para>To load a Haskell source file into GHCi, use the
     <literal>:load</literal> command:</para>
     <indexterm><primary><literal>:load</literal></primary></indexterm>