[commit: ghc] master: Move comments about evaluating the message to the top of the module (6fa285d)
git at git.haskell.org
git at git.haskell.org
Sun Feb 15 20:22:00 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/6fa285d77bba2d391b5d2b3c3abe1f19d298483c/ghc
>---------------------------------------------------------------
commit 6fa285d77bba2d391b5d2b3c3abe1f19d298483c
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Sun Feb 15 20:22:57 2015 +0000
Move comments about evaluating the message to the top of the module
The remarks apply equally to all the functions here (Trac #9795)
>---------------------------------------------------------------
6fa285d77bba2d391b5d2b3c3abe1f19d298483c
libraries/base/Debug/Trace.hs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libraries/base/Debug/Trace.hs b/libraries/base/Debug/Trace.hs
index c81abbf..47abcae 100644
--- a/libraries/base/Debug/Trace.hs
+++ b/libraries/base/Debug/Trace.hs
@@ -60,7 +60,11 @@ import Data.List
-- The 'trace', 'traceShow' and 'traceIO' functions print messages to an output
-- stream. They are intended for \"printf debugging\", that is: tracing the flow
-- of execution and printing interesting values.
-
+--
+-- All these functions evaluate the message completely before printing
+-- it; so if the message is not fully defined, none of it will be
+-- printed.
+--
-- The usual output stream is 'System.IO.stderr'. For Windows GUI applications
-- (that have no stderr) the output is directed to the Windows debug console.
-- Some implementations of these functions may decorate the string that\'s
@@ -102,10 +106,6 @@ For example, this returns the value of @f x@ but first outputs the message.
> trace ("calling f with x = " ++ show x) (f x)
-The 'trace' function evaluates the message (i.e. the first argument) completely
-before printing it; so if the message is not fully defined, none of it
-will be printed.
-
The 'trace' function should /only/ be used for debugging, or for monitoring
execution. The function is not referentially transparent: its type indicates
that it is a pure function but it has the side effect of outputting the
More information about the ghc-commits
mailing list