trac #2362 (full import syntax in ghci)
[ghc-hetmet.git] / docs / users_guide / ghci.xml
index d929548..1ff5ffd 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>
 
@@ -586,10 +589,12 @@ hello
 Prelude IO>
 </screen>
 
-      <para>(Note: you can use <literal>import M</literal> as an
-      alternative to <literal>:module +M</literal>, and
+      <para>(Note: you can use conventional
+      haskell <literal>import</literal> syntax as
+      well, but this does not support
+      <literal>*</literal> forms).
       <literal>:module</literal> can also be shortened to 
-      <literal>:m</literal>). The full syntax of the
+      <literal>:m</literal>. The full syntax of the
       <literal>:module</literal> command is:</para>
 
 <screen>
@@ -814,12 +819,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 +2336,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>
@@ -2908,6 +2923,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>