
23 Oct
2006
23 Oct
'06
3:50 p.m.
On Mon, Oct 23, 2006 at 08:48:24PM +0200, Bas van Dijk wrote:
So it seems that 'parseFiles' tries to open all the ~18.000 files and gets exhausted when opening the 14994 file.
What I would like is 'take 3 =<< parseFiles' to read only the first 3 files.
Is this possible, and if so, what is the best way to do this?
parseFiles :: IO [T] parseFiles = mapM parseFile =<< getFileFPs
use this function instead of mapM above: unsafeInterleaveMapIO f (x:xs) = unsafeInterleaveIO $ do y <- f x ys <- unsafeInterleaveMapIO f xs return (y : ys) unsafeInterleaveMapIO _ [] = return [] Best regards Tomasz