X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=docs%2Fusers_guide%2Fghci.xml;h=3ba2012eee34a086f7cd4ac1cb7fa227c7f6c1a5;hb=0093a2827f6b4007c4fcb298a559c9b7dd17aec1;hp=82ee33054d6bdbeda1f1b04cc26730a7abfac83f;hpb=8fcfc8d6e42ea5bf49422024bc71d3728ee97db9;p=ghc-hetmet.git
diff --git a/docs/users_guide/ghci.xml b/docs/users_guide/ghci.xml
index 82ee330..3ba2012 100644
--- a/docs/users_guide/ghci.xml
+++ b/docs/users_guide/ghci.xml
@@ -393,9 +393,9 @@ Prelude>
Show
- The automatic printing of binding results can be supressed with
+ The automatic printing of binding results can be suppressed with
(this does not
- supress printing the result of non-binding statements).
+ suppress printing the result of non-binding statements).
.
You might want to do this to prevent the result of binding
statements from being fully evaluated by the act of printing
@@ -929,6 +929,7 @@ right :: [a]
left:
+[qsort.hs:2:15-46] *Main> :set -fprint-evld-with-show
[qsort.hs:2:15-46] *Main> :print left
left = (_t1::[a])
@@ -948,6 +949,13 @@ left = (_t1::[a])
underscore, in this case
_t1.
+ The flag -fprint-evld-with-show instructs
+ :print to reuse
+ available Show instances when possible. This happens
+ only when the contents of the variable being inspected
+ are completely evaluated.
+
+
If we aren't concerned about preserving the evaluatedness of a
variable, we can use :force instead of
:print. The :force command
@@ -1017,6 +1025,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
@@ -1109,8 +1118,10 @@ right :: [a]
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.
+ reached. Use :steplocal to limit the set
+ of enabled breakpoints to those in the current top level function.
+ Similarly, use :stepmodule to single step only on
+ breakpoints contained in the current module.
For example:
@@ -1122,51 +1133,12 @@ _result :: IO ()
The command :step
expr begins the evaluation of
expr in single-stepping mode. If
- expr is ommitted, then it single-steps from
+ expr is omitted, then it single-steps from
the current breakpoint. :stepover
works similarly.
-
- In the current version of the debugger, :stepover
- is limited to work locally in the lexical sense, that is in the context
- of the current expression body.
- When you run to the end of the expression, :stepover
- stops working and switches to behave like regular :step.
- This means
- that it will fail to step over the last function application. As a result,
- currently :stepover works great for monadic code, but
- interacts less perfectly with pure code. For example, if stopped at the
- line 2, on the entire expression
- qsort left ++ [a] ++ qsort right:
-
-... [qsort2.hs:2:15-46] *Main> :step
-Stopped at qsort2.hs:2:15-46
-
-... [qsort2.hs:2:15-46] *Main> :list
-2 qsort (a:as) = qsort left ++ [a] ++ qsort right
-
-
- The first :stepover will step over the first
- qsort recursive call, as expected. The second one
- will step over the evaluation of [a], again as
- expected. However, the third one has lexically run out
- of the current expression, and will behave like regular
- :step, performing one step of lazy evaluation and
- stopping at the next breakpoint. In this case it is indeed the second
- recursive application of qsort.
-
-[qsort2.hs:2:36-46] *Main> :stepover
-Warning: no more breakpoints in this function body, switching to :step
-Stopped at qsort2.hs:(1,0)-(3,55)
-
-[qsort2.hs:2:36-46] *Main> :list
-_result :: [a]
-1 qsort [] = []
-2 qsort (a:as) = qsort left ++ [a] ++ qsort right
-3 where (left,right) = (filter (<=a) as, filter (>a) as)
-
+
The :list command is particularly useful when
- single-stepping, to see where you currently are, as just shown
- in the above example.
+ single-stepping, to see where you currently are:
[qsort.hs:5:7-47] *Main> :list
@@ -1372,9 +1344,13 @@ a :: a
:trace and :history to establish
the context. However, head is in a library and
we can't set a breakpoint on it directly. For this reason, GHCi
- provides the flag -fbreak-on-exception which causes
- the evaluator to stop when an exception is thrown, just as it does when
- a breakpoint is hit. This is only really useful in conjunction with
+ provides the flags -fbreak-on-exception which causes
+ the evaluator to stop when an exception is thrown, and
+ -fbreak-on-error, which works similarly but stops only on
+ uncaught exceptions. When stopping at an exception, GHCi will act
+ just as it does when a breakpoint is hit, with the deviation that it
+ will not show you any source code location. Due to this, these
+ commands are only really useful in conjunction with
:trace, in order to log the steps leading up to the
exception. For example:
@@ -1528,10 +1504,6 @@ Just 20
CAF (e.g. main), stop at a breakpoint, and ask for the value of the
CAF at the prompt again.
- :stepover only works lexically locally, in the
- body of the current expression. As a result, it can be rather impredictable
- when used in pure functional code, as opposed to monadic code.
-
Implicit parameters (see ) are only available
at the scope of a breakpoint if there is an explicit type signature.
@@ -1708,17 +1680,20 @@ $ ghci -lm
- :browse*module ...
+ :browse*module ...
:browseDisplays the identifiers defined by the module
module, which must be either
- loaded into GHCi or be a member of a package. If the
- * symbol is placed before the module
- name, then all the identifiers defined
- in module are shown; otherwise
- the list is limited to the exports of
+ loaded into GHCi or be a member of a package. If
+ module is omitted, the most
+ recently-loaded module is used.
+
+ If the * symbol is placed before
+ the module name, then all the
+ identifiers in scope in module are
+ shown; otherwise the list is limited to the exports of
module. The
*-form is only available for modules
which are interpreted; for compiled modules (including
@@ -1785,7 +1760,7 @@ $ ghci -lm
Generates a “tags” file for Vi-style editors
(:ctags) or
Emacs-style editors (:etags). If
- no filename is specified, the defaulit tags or
+ no filename is specified, the default tags or
TAGS is
used, respectively. Tags for all the functions, constructors and
types in the currently loaded modules are created. All modules must