Hal Daume <[EMAIL PROTECTED]> writes:
> [seq is] useful for:
> 
> debug :: Show a => a -> a
> debug x = unsafePerformIO (hPutStrLn stderr (show x)) `seq` x
> 
> (Presumably "trace" is defined similarly)
> 
> One may ask the question: what is seq useful for not in conjunction with
> unsafePerformIO, other than efficiency.  That, I don't know the answer to.


Of course, this can be defined without seq:

> debug :: Show a => a -> a
> debug x = unsafePerformIO (hPutStrLn stderr (show x) >> return x)

-- 
Alastair Reid        Reid Consulting (UK) Ltd
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to