On Sat, Mar 13, 2010 at 3:58 PM, Arnoldo Muller <arnoldomuller@gmail.com> wrote:
Jason,

I am trying to use haskell in the analysis of bio data. One of the main reasons I wanted to use haskell is because lazy I/O allows you to see a large bio-sequence as if it was a string in memory.
In order to achieve the same result in an imperative language I would have to write lots of error-prone iterators. I saw lazy I/O as a very strong point in favor of Haskell.


There's a safer lazy IO lib in Hackage:

http://hackage.haskell.org/package/safe-lazy-io

It seems the safer approach, though somewhat more confusing to some people, is the Iteratee pattern.

The reasons why have probably been explained best on a paper on Oleg's site.   
 
Besides the space leaks that can occur and that are a bit difficult to find for a newbie like me, are there any other reasons to avoid Lazy I/O?

Perhaps these two links will enlighten you.   They did for me, and I'm now working out how exactly to convert a really inefficient but explicit IO program (char by char right now... yuck) to an Iteratee based parsing situation on a work-related project.  Hopefully I'll be doing this all this coming week, and I'll be able to publish some results on my blog.  (things come up though a lot at work, so I'm keeping my fingers crossed on this one).

http://okmij.org/ftp/Haskell/Iteratee/Lazy-vs-correct.txt
http://okmij.org/ftp/Streams.html
 
Dave

Arnoldo.


On Sat, Mar 13, 2010 at 6:46 PM, Jason Dagit <dagit@codersbase.com> wrote:


On Thu, Mar 11, 2010 at 3:44 PM, Arnoldo Muller <arnoldomuller@gmail.com> wrote:
Daniel,

Thank you so much for helping me out with this issue!

Thanks to all the other answers from haskel-cafe members too!

As a newbie, I am not able to understand why zip and map would make a problem...

Is there any link I could read that could help me to understand why in this case
zip and map created a leak? What are some function compositions that should be
avoided when doing lazy I/O?

Actually, it's lazy I/O itself that should be avoided.

Jason


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