[project @ 2001-04-27 08:52:19 by simonmar]
[ghc-hetmet.git] / ghc / docs / users_guide / ghci.sgml
index ce05983..6688862 100644 (file)
@@ -27,7 +27,7 @@
 $ ghci
    ___         ___ _
   / _ \ /\  /\/ __(_)
- / /_\// /_/ / /  | |      GHC Interactive, version 4.11, For Haskell 98.
+ / /_\// /_/ / /  | |      GHC Interactive, version 5.00, For Haskell 98.
 / /_\\/ __  / /___| |      http://www.haskell.org/ghc/
 \____/\/ /_/\____/|_|      Type :? for help.
 
@@ -73,7 +73,7 @@ Prelude>
 <screen>
 Prelude> 1+2
 3
-PrePrelude> let x = 42 in x / 9
+Prelude> let x = 42 in x / 9
 4.666666666666667
 Prelude> 
 </screen>
@@ -557,7 +557,7 @@ $ ghci Main.hs
 $ ghci -package text
    ___         ___ _
   / _ \ /\  /\/ __(_)
- / /_\// /_/ / /  | |      GHC Interactive, version 4.11, For Haskell 98.
+ / /_\// /_/ / /  | |      GHC Interactive, version 5.00, For Haskell 98.
 / /_\\/ __  / /___| |      http://www.haskell.org/ghc/
 \____/\/ /_/\____/|_|      Type :? for help.
 
@@ -716,7 +716,7 @@ Prelude> :def make (\_ -> return ":! ghc --make Main")
       </varlistentry>
 
       <varlistentry>
-       <term><literal>:quit</literal> <replaceable>module</replaceable></term>
+       <term><literal>:quit</literal></term>
        <indexterm><primary><literal>:quit</literal></primary></indexterm>
        <listitem>
          <para>Quits GHCi.  You can also quit by typing a control-D
@@ -927,6 +927,22 @@ Prelude> :set -fno-glasgow-exts
     
     <variablelist>
       <varlistentry>
+       <term>GHCi complains about <function>main</function> not being
+       in scope when I load a module.</term>
+       <indexterm><primary><function>main</function></primary><secondary>with GHCi</secondary>
+       </indexterm>
+       <listitem>
+         <para>You probably omitted the <literal>module</literal>
+         declaration at the top of the module, which causes the
+         module name to default to <literal>Main</literal>.  In
+         Haskell, the <literal>Main</literal> module must define a
+         function called <function>main</function>.  Admittedly this
+         doesn't make a great deal of sense for an interpreter, but
+         the rule was kept for compatibility with GHC.</para>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
        <term><literal>System.exit</literal> causes GHCi to exit!</term>
        <indexterm><primary><literal>System.exit</literal></primary><secondary>in
        GHCi</secondary></indexterm>