[Haskell-cafe] How to deal with huge text file?

Ivan Miljenovic ivan.miljenovic at gmail.com
Mon May 24 22:12:04 EDT 2010


On 25 May 2010 12:02, Magicloud Magiclouds
<magicloud.magiclouds at gmail.com> wrote:
> U is for UTF8 module. And I will try the modules you mentioned.
> Although I thought Haskell IO is lazy enough....

If you're only streaming data, it probably would be.  However, you
seem to keep some of it in memory, which is what the problem is.  You
might be able to fix this by doing "main = readFile filename >>= liftM
separateOutput >>= mapM_ foo".  However, it depends on what
separateOutput does.

Also, consider using when (from Control.Monad) instead of your if statement.

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com


More information about the Haskell-Cafe mailing list