[Haskell-cafe] Getting WriterT log lazily

Stephen Hicks stephenhicks at gmail.com
Wed May 6 12:28:56 EDT 2009


Magnus Therning wrote:
> Martijn van Steenbergen wrote:
>>
>> Otherwise, you can use unsafeInterleaveIO: no unsafePerformIO or seq
>> needed, but there's still "unsafe" in that name there. This works for me:
...
> Thanks, that does indeed work, but it still requires that "unsafe" there so
> I'm hesitant replacing the call to threadDelay with something more
> complicated, where it isn't obviously safe.

Sorry for the late reply, but I'd like to piggy-back on this.  It's my
understanding that unsafeInterleaveIO is only unsafe insofar as it
makes the IO lazy and so the IO may be performed later or never at all
(if its return value is never wanted) and is therefore no less safe
than, say, generating a list of IO actions as was suggested by an
earlier reply.  It seems to me that its unsafeness is of a completely
different nature than unsafePerformIO...  am I missing something?

steve


More information about the Haskell-Cafe mailing list