traceM and traceShowM

Martijn van Steenbergen martijn at van.steenbergen.nl
Thu Nov 5 07:34:07 EST 2009


Philip K.F. Hölzenspies wrote:
> As a post-deadline suggestion to fix Simon's (valid) reservation:
> 
> traceShowM :: (Show a, Monad m) => a -> m a
> traceShowM a = traceM (show a) a
> 
> This allows easier trace insertion, e.g.:

I disagree. I think it's easier to remove/comment/uncomment (which you 
do often with trace statements) a whole line than part of a line.

On the other hand, you can still use this function as a standalone line. 
But I don't like having monadic functions return something when that's 
not necessary, even though I cannot think of a clear argument against it 
at the moment. :-(

So I guess either way is fine. Does anyone else know any criteria to 
decide one way or another?

Martijn.


More information about the Libraries mailing list