projects
/
ghc-base.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add traceShow (see #474)
[ghc-base.git]
/
Debug
/
Trace.hs
diff --git
a/Debug/Trace.hs
b/Debug/Trace.hs
index
3e369f5
..
4091521
100644
(file)
--- a/
Debug/Trace.hs
+++ b/
Debug/Trace.hs
@@
-28,7
+28,7
@@
import System.IO (hPutStrLn,stderr)
#endif
-- | 'putTraceMsg' function outputs the trace message from IO monad.
#endif
-- | 'putTraceMsg' function outputs the trace message from IO monad.
--- Usually the output stream is 'stderr' but if the function is called
+-- Usually the output stream is 'System.IO.stderr' but if the function is called
-- from Windows GUI application then the output will be directed to the Windows
-- debug console.
putTraceMsg :: String -> IO ()
-- from Windows GUI application then the output will be directed to the Windows
-- debug console.
putTraceMsg :: String -> IO ()
@@
-56,3
+56,11
@@
trace :: String -> a -> a
trace string expr = unsafePerformIO $ do
putTraceMsg string
return expr
trace string expr = unsafePerformIO $ do
putTraceMsg string
return expr
+
+{-|
+Like 'trace', but uses 'show' on the argument to convert it to a 'String'.
+
+> traceShow = trace . show
+-}
+traceShow :: (Show a) => a -> b -> b
+traceShow = trace . show