From: simonmar Date: Mon, 13 Jun 2005 14:36:01 +0000 (+0000) Subject: [project @ 2005-06-13 14:36:01 by simonmar] X-Git-Tag: Initial_conversion_from_CVS_complete~432 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=91314304c1886f4889c82ae5deb54adf4062e258;p=ghc-hetmet.git [project @ 2005-06-13 14:36:01 by simonmar] - Fix up documentation for about new automatic printing semantics - Document :tags --- diff --git a/ghc/docs/users_guide/ghci.xml b/ghc/docs/users_guide/ghci.xml index a0210ea..cac0e11 100644 --- a/ghc/docs/users_guide/ghci.xml +++ b/ghc/docs/users_guide/ghci.xml @@ -63,6 +63,7 @@ Prelude> :show modules show the currently loaded modules :show bindings show the current bindings made at the prompt + :tags -e|-c create tags file for Vi (-c) or Emacs (-e) :type <expr> show the type of <expr> :kind <type> show the kind of <type> :undef <cmd> undefine user-defined command :<cmd> @@ -428,16 +429,30 @@ Prelude> x in future statements, for example to print it as we did above. + GHCi will print the result of a statement if and only if: + + + The statement is not a binding, or it is a monadic binding + (p <- e) that binds exactly one + variable. + + + The variable's type is not polymorphic, is not + (), and is an instance of + Show + + + + Of course, you can also bind normal non-IO expressions using the let-statement: Prelude> let x = 42 -42 -Prelude> print x +Prelude> x 42 Prelude> - An important difference between the two types of binding + Another important difference between the two types of binding is that the monadic bind (p <- e) is strict (it evaluates e), whereas with the let form, the expression @@ -448,22 +463,16 @@ Prelude> print x *** Exception: help! Prelude> -GHCi will print the result of a -x<-e statement if and only if: - -The statement binds exactly one variable -The variable's type is not polymorphic, is not -(), -and is an instance of Show - - + + Note that let bindings do not automatically + print the value bound, unlike monadic bindings. + Any exceptions raised during the evaluation or execution of the statement are caught and printed by the GHCi command line interface (for more information on exceptions, see the module Control.Exception in the libraries documentation). - Every new binding shadows any existing bindings of the same name, including entities that are in scope in the current module context. @@ -493,7 +502,7 @@ Prelude> let (x:xs) = [1..] x :: Integer xs :: [Integer] - + @@ -1129,6 +1138,23 @@ Prelude> :. cmds.ghci + :tags -c|-e + :tags + + + + Generates a “tags” file for either Vi-style editors + (-c) or Emacs-style editors + (-e). The file generated will be called + tags or TAGS + respectively. + + See also . + + + + + :type expression :type