> An ugly solution is to explicitly keep a<br>> pointer to the next unevaluated entry, advancing it in the interleaved<br>> IO operation. A leaky solution is to keep a reference to the list, and<br>> force it all.
<br><br>Another way to attack this is asking: Why doesn't the simple solution work? That is, not using unsafeInterleaveIO.<br><br>It seems like any problem caused by not using unsafeInterleaveIO is fundamentally because the IO monad encapsulates orthogonal regions. Why can't I interleave fetching rows from the DB with writing each row to the console? Sure, it is *possible* that writing to the console is piped back into the same database, but if not, you're serializing things that don't need to be serialized.