[Haskell-cafe] how to print out intermediate results in a recursive function?

Ozgur Akgun ozgurakgun at gmail.com
Sat Feb 4 06:00:51 CET 2012


Hi,

There is also this nice trick to use Debug.Trace:

merge xs ys | trace (show (xs,ys)) False = undefined -- add this as the
first case to merge
mergesort xs | trace (show xs) False = undefined -- and this as the first
case to mergesort

HTH,
Ozgur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120204/5b07bb27/attachment.htm>


More information about the Haskell-Cafe mailing list