
20 Jul
2006
20 Jul
'06
6:09 a.m.
Hi, Either one of these will work: main = do putStrLn "xxx" x <- return (trace "yyy" ()) x `seq` putStrLn "zzz" main = do putStrLn "xxx" trace "yyy" (return ()) putStrLn "zzz" This works fine, the problem is that trace is defined to output the first parameter before returning the second. In the case of return () the () is never evaluated, hence the item is never generated, and the trace is not fired. Adding a seq to the result gets the trace going. This just shows how fragile trace is! However, if you use it in a real situation, rather than just a play one like this, it will probably work for you. Thanks Neil