[commit: ghc] ghc-7.10: Move comments about evaluating the message to the top of the module (35a0b67)
git at git.haskell.org
git at git.haskell.org
Mon Feb 23 12:41:00 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-7.10
Link : http://ghc.haskell.org/trac/ghc/changeset/35a0b67dc284f8dca47089538c9ee68b06dc6f39/ghc
>---------------------------------------------------------------
commit 35a0b67dc284f8dca47089538c9ee68b06dc6f39
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)
(cherry picked from commit 6fa285d77bba2d391b5d2b3c3abe1f19d298483c)
>---------------------------------------------------------------
35a0b67dc284f8dca47089538c9ee68b06dc6f39
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