[GHC] #3634: Add traceM, traceShowM and withTrace

View: New views
2 Messages — Rating Filter:   Alert me  

[GHC] #3634: Add traceM, traceShowM and withTrace

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#3634: Add traceM, traceShowM and withTrace
----------------------------------+-----------------------------------------
Reporter:  MartijnVanSteenbergen  |          Owner:                  
    Type:  proposal               |         Status:  new            
Priority:  normal                 |      Component:  libraries/base  
 Version:  6.10.4                 |       Severity:  normal          
Keywords:                         |       Testcase:                  
      Os:  Unknown/Multiple       |   Architecture:  Unknown/Multiple
----------------------------------+-----------------------------------------
 On haskell-libraries we have
 [http://thread.gmane.org/gmane.comp.lang.haskell.libraries/12019
 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.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3634>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Re: [GHC] #3634: Add traceM, traceShowM and withTrace

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#3634: Add traceM, traceShowM and withTrace
--------------------------------------+-------------------------------------
    Reporter:  MartijnVanSteenbergen  |        Owner:                  
        Type:  proposal               |       Status:  new            
    Priority:  normal                 |    Milestone:  Not GHC        
   Component:  libraries/base         |      Version:  6.10.4          
    Severity:  normal                 |   Resolution:                  
    Keywords:                         |   Difficulty:  Unknown        
    Testcase:                         |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple       |  
--------------------------------------+-------------------------------------
Changes (by igloo):

  * difficulty:  => Unknown
  * milestone:  => Not GHC

Comment:

 I'm not sure the discussion has reached a conclusion yet, e.g. in
 http://article.gmane.org/gmane.comp.lang.haskell.libraries/12087
 Simon Marlow asks if `traceShowM` is necessary. It might be better to send
 a current summary message to the list, and see if there are any more
 comments.

 If we do have a `traceShowM` then I would have thought
 {{{
 traceShowM :: (Show a, Monad m) => String -> a -> m ()
 traceShowM msg x = traceM (msg ++ show x)
 }}}
 to be more useful, similar to withTrace.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3634#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs