<div dir="ltr"><div>My guess is that your lines are small enough that they always end up in a single chunk, and therefore you're essentially folding over a list of length 1.<br><br></div>I'm confused about your question though: isn't `number` the current line?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 7, 2015 at 1:04 PM, Kees Bleijenberg <span dir="ltr"><<a href="mailto:K.Bleijenberg@lijbrandt.nl" target="_blank">K.Bleijenberg@lijbrandt.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div link="blue" vlink="purple" lang="NL"><div><p class="MsoNormal">My goal is to parse a big text-file line by line using the same parser for every line.<u></u><u></u></p><p class="MsoNormal">I am new to Conduit and I’ve read this <a href="https://www.fpcomplete.com/user/chad/snippets/random-code-snippets/folding-lines-in-conduit" target="_blank">https://www.fpcomplete.com/user/chad/snippets/random-code-snippets/folding-lines-in-conduit</a> article.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">After adding import Control.Monad.Trans.Resource for runResourceT and adding rankNTypes, I got it working. <u></u><u></u></p><p class="MsoNormal">Code in <a href="http://www.tbsoftware.nl/TestConduit/TestConduit7.hs" target="_blank">www.tbsoftware.nl/TestConduit/TestConduit7.hs</a><u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I don't understand what is going on in myFunc. Does CL.fold fold over the already read lines? <u></u><u></u></p><p class="MsoNormal">I wonder whether CL.fold loads the whole file in memory?<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">if I change <u></u><u></u></p><p class="MsoNormal"> count <- CL.fold (\count t -> count + T.length t) 0 to<u></u><u></u></p><p class="MsoNormal"> count <- CL.fold (\count t -> T.length t) 0 <u></u><u></u></p><p class="MsoNormal">nothing changes in the output. If count is always zero, why using a fold?<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">How can I get the ‘current line’ in myFunc? <span class="HOEnZb"><font color="#888888"><u></u><u></u></font></span></p><span class="HOEnZb"><font color="#888888"><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Kees<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p></font></span></div></div><br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>