15 May
2002
15 May
'02
12:09 a.m.
Hal Daume <hdaume@ISI.EDU> 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