It's one of those quirks arising from historical decisions that makes Haskell's non-strict idioms pathological where resources are limited. (A very real and common case.) You need very strict, possibly explicit, file handle management here.

Look to APIs that deal with this problem in a way that suits your situation better: System.IO.Strict may be an option.

Cheers,
Darren

On Jun 24, 2014 9:33 AM, "C K Kashyap" <ckkashyap@gmail.com> wrote:
That is what is particularly frustrating...its a tiny program and somewhat trivial thing that I am trying to achieve.

If I use mapM as suggested by others, I quickly run into - 

openFile: resource exhausted (Too many open files)

Regards,

Kashyap


Regards,
Kashyap


On Tue, Jun 24, 2014 at 9:59 PM, Brandon Allbery <allbery.b@gmail.com> wrote:
On Tue, Jun 24, 2014 at 12:25 PM, C K Kashyap <ckkashyap@gmail.com> wrote:
I used unsafeInterleaveIO after I ran into "too many open file handles" error.

That all by itself makes me think your problem is elsewhere and unsafeInterleaveIO is just covering it up.

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe