Update ghci example output in user guide; patch from YitzGale in #4111
[ghc-hetmet.git] / docs / users_guide / ghci.xml
index 402c7cb..6e54ace 100644 (file)
 
 <screen>
 $ ghci
-GHCi, version 6.8.1: http://www.haskell.org/ghc/  :? for help
+GHCi, version 6.12.1: http://www.haskell.org/ghc/  :? for help
+Loading package ghc-prim ... linking ... done.
+Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
+Loading package ffi-1.0 ... linking ... done.
 Prelude> 
 </screen>
 
@@ -814,12 +817,12 @@ it &lt;- <replaceable>e</replaceable>
   ghci> reverse []
 </programlisting>
       What should GHCi do?  Strictly speaking, the program is ambiguous.  <literal>show (reverse [])</literal>
-      (which is what GHCi computes here) has type <literal>Show a => a</literal> and how that displays depends 
+      (which is what GHCi computes here) has type <literal>Show a => String</literal> and how that displays depends
       on the type <literal>a</literal>.  For example:
 <programlisting>
-  ghci> (reverse []) :: String
+  ghci> reverse ([] :: String)
   ""
-  ghci> (reverse []) :: [Int]
+  ghci> reverse ([] :: [Int])
   []
 </programlisting>
     However, it is tiresome for the user to have to specify the type, so GHCi extends Haskell's type-defaulting
@@ -2331,6 +2334,16 @@ bar
 
       <varlistentry>
        <term>
+          <literal>:run</literal>
+          <indexterm><primary><literal>:run</literal></primary></indexterm>
+        </term>
+       <listitem>
+         <para>See <literal>:main</literal>.</para>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term>
           <literal>:set</literal> <optional><replaceable>option</replaceable>...</optional>
           <indexterm><primary><literal>:set</literal></primary></indexterm>
         </term>
@@ -2386,7 +2399,9 @@ bar
          Inside <replaceable>prompt</replaceable>, the sequence
          <literal>%s</literal> is replaced by the names of the
          modules currently in scope, and <literal>%%</literal> is
-         replaced by <literal>%</literal>.</para>
+         replaced by <literal>%</literal>. If <replaceable>prompt</replaceable>
+      starts with &quot; then it is parsed as a Haskell String;
+      otherwise it is treated as a literal string.</para>
         </listitem>
       </varlistentry>
 
@@ -2906,6 +2921,13 @@ Prelude> :set -fno-glasgow-exts
             because this is normally what you want in an interpreter:
             output appears as it is generated.
           </para>
+          <para> 
+            If you want line-buffered behaviour, as in GHC, you can 
+            start your program thus:
+            <programlisting>
+               main = do { hSetBuffering stdout LineBuffering; ... }
+            </programlisting>
+          </para>
         </listitem>
       </varlistentry>
     </variablelist>