<meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="font-family: verdana, geneva, helvetica, arial, sans-serif; font-size: 13px; border-collapse: collapse; ">Hi, <br>I&#39;m a new Haskell programmer and am trying to output the values of some of the variables (for debugging) as the program executes. <br>

<br>At the moment to output the value of the function I use: <br>f x y z = trace (show moves) moves <br>   where moves = [complicated expression of x y z] <br><br>But really what I want is to be able to write: <br>f x y z = trace2 [complicated expression of x y z] <br>

<br>Is there a standard function to do this? I tried: <br>trace2 a = trace (show a) a <br><br>But I got the error: <br>    Couldn&#39;t match expected type `t1 -&gt; t&#39; <br>           against inferred type `String&#39; <br>

    In the expression: (show a) a <br>    In the definition of `trace2&#39;: trace2 a = (show a) a <br><br>How do I fix it? <br><br>Thanks, </span><br clear="all"><br>
<div>Ben</div>