I don't know why people use trace this way instead of in the reverse form:<div><br></div><div>debug = flip trace</div><div><br></div><div>this way I can isolate debug code in the right from normal code:</div><div><br>
</div><div><br></div><div>main= do</div><div> a <- getChar</div><div> b <- getChar `debug` ("a="++ show a)</div><div> let c= a+b `debug` ("b="++ show b)</div>
<div> ...</div><div>and so on.</div><div><br></div><div>I saw it for the first time in the DrIFt libtary.</div><div><br><br><div class="gmail_quote">2009/10/20 Justin Bailey <span dir="ltr"><<a href="mailto:jgbailey@gmail.com">jgbailey@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">These woudl be much more useful if they flushed the output handle<br>
after each message. Then you know your trace messages will be<br>
displayed/written to a file.<br>
<div><div></div><div class="h5"><br>
On Mon, Oct 19, 2009 at 1:51 PM, Thomas Hartman <<a href="mailto:tphyahoo@gmail.com">tphyahoo@gmail.com</a>> wrote:<br>
> I have this and a couple other handy functions in<br>
><br>
> DebugTraceHelpers:<br>
><br>
> <a href="http://patch-tag.com/r/tphyahoo/DebugTraceHelpers/snapshot/current/content/pretty" target="_blank">http://patch-tag.com/r/tphyahoo/DebugTraceHelpers/snapshot/current/content/pretty</a><br>
><br>
> hackage:<br>
><br>
> <a href="http://hackage.haskell.org/packages/archive/DebugTraceHelpers/0.12/doc/html/Debug-Trace-Helpers.html" target="_blank">http://hackage.haskell.org/packages/archive/DebugTraceHelpers/0.12/doc/html/Debug-Trace-Helpers.html</a><br>
><br>
><br>
> 2009/10/16 Martijn van Steenbergen <<a href="mailto:martijn@van.steenbergen.nl">martijn@van.steenbergen.nl</a>>:<br>
>> Hello,<br>
>><br>
>> I propose the addition of the following two functions to module Debug.Trace:<br>
>><br>
>>> traceM :: Monad m => String -> m ()<br>
>>> traceM msg = trace msg (return ())<br>
>>><br>
>>> traceShowM :: (Show a, Monad m) => a -> m ()<br>
>>> traceShowM = traceM . show<br>
>><br>
>> These functions allow tracing in any do-block. I often define them myself; I<br>
>> think they are useful in general.<br>
>><br>
>> Deadline: 23 October 2009.<br>
>><br>
>> Martijn.<br>
>> _______________________________________________<br>
>> Libraries mailing list<br>
>> <a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
>> <a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/mailman/listinfo/libraries</a><br>
>><br>
> _______________________________________________<br>
> Haskell-Cafe mailing list<br>
> <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
> <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
><br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br></div>