[commit: ghc] master: Improve documentation of 'trace' (7fdded4)

git at git.haskell.org git at git.haskell.org
Fri Feb 13 23:08:52 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/7fdded4ed7e670e0c83d312b56a59b36c52913c9/ghc

>---------------------------------------------------------------

commit 7fdded4ed7e670e0c83d312b56a59b36c52913c9
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Feb 13 23:10:18 2015 +0000

    Improve documentation of 'trace'
    
    See Trac #9795.


>---------------------------------------------------------------

7fdded4ed7e670e0c83d312b56a59b36c52913c9
 libraries/base/Debug/Trace.hs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libraries/base/Debug/Trace.hs b/libraries/base/Debug/Trace.hs
index 389eb19..c81abbf 100644
--- a/libraries/base/Debug/Trace.hs
+++ b/libraries/base/Debug/Trace.hs
@@ -102,6 +102,10 @@ 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