diff --git a/libraries/base/src/Debug/Trace.hs b/libraries/base/src/Debug/Trace.hs index b7532c234387bb0e2890fcf7750a29aa6d1b6949..4d3f8e3f4f97738873b12d4663bcd4b997775107 100644 --- a/libraries/base/src/Debug/Trace.hs +++ b/libraries/base/src/Debug/Trace.hs @@ -143,13 +143,15 @@ traceId a = trace a a Like 'trace', but uses 'show' on the argument to convert it to a 'String'. This makes it convenient for printing the values of interesting variables or -expressions inside a function. For example here we print the value of the +expressions inside a function. For example, here we print the values of the variables @x@ and @y@: ->>> let f x y = traceShow (x,y) (x + y) in f (1+2) 5 -(3,5) +>>> let f x y = traceShow ("x", x, "y", y) (x + y) in f (1+2) 5 +("x",3,"y",5) 8 +Note in this example we also create simple labels just by including some strings. + -} traceShow :: Show a => a -> b -> b traceShow = trace . show