
19 Mar
2010
19 Mar
'10
4:03 p.m.
Hi, I'm a new Haskell programmer and am trying to output the values of some of the variables (for debugging) as the program executes. At the moment to output the value of the function I use: f x y z = trace (show moves) moves where moves = [complicated expression of x y z] But really what I want is to be able to write: f x y z = trace2 [complicated expression of x y z] Is there a standard function to do this? I tried: trace2 a = trace (show a) a But I got the error: Couldn't match expected type `t1 -> t' against inferred type `String' In the expression: (show a) a In the definition of `trace2': trace2 a = (show a) a How do I fix it? Thanks, Ben
5545
Age (days ago)
5545
Last active (days ago)
2 comments
3 participants
participants (3)
-
Ben Derrett
-
Brent Yorgey
-
Thomas DuBuisson