X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=docs%2Fusers_guide%2Fghci.xml;h=a8ebbd7b661b9f21d9d8713a2cbd2dc3284b1cdd;hb=f17c76a4fc51a52ccda154ec9e4990f13f78c8c2;hp=c60e24946172c6741e0f6fab53578c4fdafcac76;hpb=69443f18d24fb9a911f27ad46c298cc21be57c61;p=ghc-hetmet.git
diff --git a/docs/users_guide/ghci.xml b/docs/users_guide/ghci.xml
index c60e249..a8ebbd7 100644
--- a/docs/users_guide/ghci.xml
+++ b/docs/users_guide/ghci.xml
@@ -1017,7 +1017,7 @@ right :: [a]
The execution continued at the point it previously stopped, and has
now stopped at the breakpoint for a second time.
-
+
Setting breakpoints
Breakpoints can be set in various ways. Perhaps the easiest way to
@@ -1106,10 +1106,12 @@ right :: [a]
Single-stepping is a great way to visualise the execution of your
program, and it is also a useful tool for identifying the source of a
- bug. The concept is simple: single-stepping enables all the
- breakpoints in the program and executes until the next breakpoint is
- reached, at which point you can single-step again, or continue
- normally. For example:
+ bug. GHCi offers two variants of stepping. Use
+ :step to enable all the
+ breakpoints in the program, and execute until the next breakpoint is
+ reached. Use :stepover to step over function
+ applications, which of course are executed all the same.
+ For example:
*Main> :step main
@@ -1118,10 +1120,11 @@ _result :: IO ()
The command :step
- expr begins the evaluation of
+ expr begins the evaluation of
expr in single-stepping mode. If
expr is ommitted, then it single-steps from
- the current breakpoint.
+ the current breakpoint. :stepover
+ works similarly.
The :list command is particularly useful when
single-stepping, to see where you currently are:
@@ -1516,9 +1519,7 @@ $ ghci Main.hs
Most of the command-line options accepted by GHC (see ) also make sense in interactive mode. The ones
- that don't make sense are mostly obvious; for example, GHCi
- doesn't generate interface files, so options related to interface
- file generation won't have any effect.
+ that don't make sense are mostly obvious.
Packages
@@ -1534,12 +1535,7 @@ $ ghci Main.hs
$ ghci -package readline
- ___ ___ _
- / _ \ /\ /\/ __(_)
- / /_\// /_/ / / | | GHC Interactive, version 6.6, for Haskell 98.
-/ /_\\/ __ / /___| | http://www.haskell.org/ghc/
-\____/\/ /_/\____/|_| Type :? for help.
-
+GHCi, version 6.8.1: http://www.haskell.org/ghc/ :? for help
Loading package base ... linking ... done.
Loading package readline-1.0 ... linking ... done.
Prelude>
@@ -1711,16 +1707,6 @@ $ ghci -lm
- :continue
- :continue
-
- Continue the current evaluation, when stopped at a
- breakpoint.
-
-
-
-
-
:cmd expr
:cmd
@@ -1735,6 +1721,16 @@ $ ghci -lm
+ :continue
+ :continue
+
+ Continue the current evaluation, when stopped at a
+ breakpoint.
+
+
+
+
+
:ctags filename
:etags filename
:etags
@@ -1744,7 +1740,8 @@ $ ghci -lm
Generates a “tags” file for Vi-style editors
- (:ctags) or Emacs-style editors (etags). If
+ (:ctags) or
+ Emacs-style editors (:etags). If
no filename is specified, the defaulit tags or
TAGS is
used, respectively. Tags for all the functions, constructors and
@@ -1852,6 +1849,15 @@ Prelude> :. cmds.ghci
+ :etags
+
+
+ See :ctags.
+
+
+
+
+
:force identifier ...
:force
@@ -1920,6 +1926,12 @@ Prelude> :. cmds.ghci
will be printed. If name has
been loaded from a source file, then GHCi will also display
the location of its definition in the source.
+ For types and classes, GHCi also summarises instances that
+ mention them. To avoid showing irrelevant information, an instance
+ is shown only if (a) its head mentions name,
+ and (b) all the other things mentioned in the instance
+ are in scope (either qualified or otherwise) as a result of
+ a :load or :module commands.
@@ -1988,7 +2000,7 @@ Prelude> :. cmds.ghci
However, we cannot simply pass the arguments to the
main function while we are testing in ghci,
as the main function doesn't take its
- directly.
+ arguments directly.
@@ -2033,7 +2045,7 @@ Prelude> :main foo bar
Prints a value without forcing its evaluation.
:print may be used on values whose types are
- unkonwn or partially known, which might be the case for local
+ unknown or partially known, which might be the case for local
variables with polymorphic types at a breakpoint. While inspecting
the runtime value, :print attempts to
reconstruct the type of the value, and will elaborate the type in
@@ -2053,7 +2065,7 @@ Prelude> :main foo bar
:quit
- Quits GHCi. You can also quit by typing a control-D
+ Quits GHCi. You can also quit by typing control-D
at the prompt.
@@ -2198,7 +2210,7 @@ Prelude> :main foo bar
:show modules
- Show the list of modules currently load.
+ Show the list of modules currently loaded.
@@ -2309,7 +2321,7 @@ Prelude> :main foo bar
The :set command sets two types of
options: GHCi options, which begin with
- ‘+” and “command-line”
+ ‘+’, and “command-line”
options, which begin with ‘-’.
NOTE: at the moment, the :set command
@@ -2421,9 +2433,10 @@ Prelude> :set -fno-glasgow-exts
startupfiles, GHCi
- When it starts, GHCi always reads and executes commands from
- $HOME/.ghci, followed by
- ./.ghci.
+ When it starts, unless the -ignore-dot-ghci
+ flag is given, GHCi reads and executes commands from
+ ./.ghci, followed by
+ $HOME/.ghci.
The .ghci in your home directory is
most useful for turning on favourite options (eg. :set
@@ -2432,7 +2445,7 @@ Prelude> :set -fno-glasgow-exts
project is a useful way to set certain project-wide options so you
don't have to type them everytime you start GHCi: eg. if your
project uses GHC extensions and CPP, and has source files in three
- subdirectories A B and C, you might put the following lines in
+ subdirectories A, B and C, you might put the following lines in
.ghci:
@@ -2580,7 +2593,19 @@ Prelude> :set -fno-glasgow-exts
I can't use Control-C to interrupt computations in
GHCi on Windows.
- See
+ See .
+
+
+
+
+ The default buffering mode is different in GHCi to GHC.
+
+
+ In GHC, the stdout handle is line-buffered by default.
+ However, in GHCi we turn off the buffering on stdout,
+ because this is normally what you want in an interpreter:
+ output appears as it is generated.
+