[Haskell-cafe] Conduit and foldLines

Michael Snoyman michael at snoyman.com
Mon Sep 7 10:07:48 UTC 2015


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.

I'm confused about your question though: isn't `number` the current line?

On Mon, Sep 7, 2015 at 1:04 PM, Kees Bleijenberg <K.Bleijenberg at lijbrandt.nl
> wrote:

> My  goal is to parse a big text-file line by line using the same parser
> for every line.
>
> I am new to Conduit and I’ve read this
> https://www.fpcomplete.com/user/chad/snippets/random-code-snippets/folding-lines-in-conduit
>  article.
>
>
>
> After adding import  Control.Monad.Trans.Resource for runResourceT and
> adding rankNTypes, I got it working.
>
> Code in www.tbsoftware.nl/TestConduit/TestConduit7.hs
>
>
>
> I don't understand what is going on in myFunc. Does CL.fold fold over the
> already read lines?
>
> I wonder whether CL.fold loads the whole file in memory?
>
>
>
> if I change
>
>             count <- CL.fold (\count t -> count + T.length t) 0 to
>
>             count <- CL.fold (\count t -> T.length t) 0
>
> nothing changes in the output.  If count is always zero, why using a fold?
>
>
>
> How can I get the ‘current line’ in myFunc?
>
>
>
> Kees
>
>
>
>
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150907/94b3dc6f/attachment.html>


More information about the Haskell-Cafe mailing list