Alexander Vodomerov <[EMAIL PROTECTED]> wrote:
> main = do
> putStrLn "xxx"
> return (trace "yyy" ())
> putStrLn "zzz"
>
> only xxx and zzz is displayed. yyy is missing.
This is because you never demanded the value of (trace "yyy" ()), so it
was never computed. The joys of laziness! To f
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 t
Alexander Vodomerov wrote:
> import Debug.Trace
>
> main = do
> putStrLn "xxx"
> return (trace "yyy" ())
> putStrLn "zzz"
>
> only xxx and zzz is displayed. yyy is missing.
> Why trace is not working?
Nothing uses the value of (trace "yyy" ()), so it is never
evaluated.
Try this instead, wh
Hello!
The function trace is supposed to write debug messages to console.
However, when I trying to run the following program
import Debug.Trace
main = do
putStrLn "xxx"
return (trace "yyy" ())
putStrLn "zzz"
only xxx and zzz is displayed. yyy is missing.
Why trace is not working?
PS.