2011/2/5 Dean Herington <heringtonlacey@mindspring.com>
In your simplified example, it suffices to wrap unsafeInterleaveIO around (mapM content ds).  In a more realistic case, you'd need to add some `unsafeInterleaveIO`s in `files` and `directories`, too.

Thanks a lot! Now it was easy to write a lazy findFiles.
Would one have to write down a lot in order to see "on paper" why the original example was not lazy? If I coud do this, I might run into fewer problems in the future.

 
Dean

P.S. You might also want to look into iteratees, which accomplish a similar goal in a more robust way.
 
Yes, I already looked over the article in Monad reader #16. But then I thaught I will first gain more understanding of the traditional way and then return to iteratees.


Regards
Tim