Add traceM, traceShowM and withTrace
On haskell-libraries we have discussed the addition of the following three functions to module Debug.Trace:
withTrace :: Show a => String -> a -> a
withTrace msg x = trace (msg ++ show x) x
traceM :: Monad m => String -> m ()
traceM msg = trace msg (return ())
traceShowM :: (Show a, Monad m) => a -> m ()
traceShowM = traceM . show
The current documentation for that module is a little terse so we have also added an example to clarify the use of trace.
The following people have participated in the discussion and all expressed interest, agreement or concerns (but always with constructive comments) in or over the new functions: Philip Hölzenspies, pepe, Lennart Augustsson, Felipe Lessa, Evan !LaForge, Joachim Breitner, Twan van Laarhoven, Ben Franksen, Ian Lynagh, Sean Leather. Please see the thread for more detail.
I have attached a diff that can be applied to the module. Could one of the GHC developers check it and apply it?
Thanks,
Martijn.
Trac metadata
Trac field | Value |
---|---|
Version | 6.10.4 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries/base |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |