[GHC] #474: Debug.Trace.trace should work on Show

GHC trac at galois.com
Mon Feb 20 09:03:11 EST 2006


#474: Debug.Trace.trace should work on Show
------------------------------+---------------------------------------------
  Reporter:  jch              |          Owner:  nobody  
      Type:  feature request  |         Status:  reopened
  Priority:  lowest           |      Milestone:  6.4.2   
 Component:  libraries/base   |        Version:  None    
  Severity:  minor            |     Resolution:          
  Keywords:                   |             Os:  Unknown 
Difficulty:  Unknown          |   Architecture:  Unknown 
------------------------------+---------------------------------------------
Old description:

> {{{
> Debug.Trace.trace has type
>
>   trace :: String -> a -> a
>
> which forces me to insert calls to show.  Could it be
> generalised to
>
>   trace :: Show a => a -> b -> b
>
> Thanks,
>
> Juliusz Chroboczek
>
> }}}

New description:

 {{{
 Debug.Trace.trace has type

   trace :: String -> a -> a

 which forces me to insert calls to show.  Could it be
 generalised to

   trace :: Show a => a -> b -> b

 Thanks,

 Juliusz Chroboczek

 }}}

Comment (by simonmar):

 This is similar to the difference between {{{print}}} and {{{putStr}}},
 that is, there are good reasons to have both.

 I've no objection to adding
 {{{
 traceShow :: Show a => a -> b -> b
 traceShow = trace . show
 }}}
 but that doesn't seem to save a whole lot of typing.  Perhaps a different
 name?

-- 
Ticket URL: <http://cvs.haskell.org/trac/ghc/ticket/474>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list