[Haskell-cafe] Help with Data.Conduit.List.mapAccum
bruno at ruomad.net
bruno at ruomad.net
Wed Jun 15 06:14:50 UTC 2016
Hello,
Thanks for the answer.
I could of course use fold, but that would eliminate the use of mapAccum, what's the use of it then if I cannot get the result ?
It's also a broader question, how to get the result of a ConduitM i o m r ?
bruno
On 15 Jun 2016 08:08 +0200, Baojun Wang<wangbj at gmail.com>, wrote:
> Foldl from conduit combinators?
> On Tue, Jun 14, 2016 at 22:54<bruno at ruomad.net(mailto:bruno at ruomad.net)>wrote:
> > Hello,
> > I'm trying to use Data.Conduit, but I get stuck with mapAccum as how to get and retrieve the result.
> > If I use it, I get a simple conduit like :
> >
> > testC :: ConduitM () Int IO Int
> > testC = Src =$= cdt where
> > src = CL.sourceList [1..10]
> > cdt = CL.mapAccum (\x s ->(x+s, x) 0
> >
> > I can get the output with
> > testC $$ CL.consume
> > but how do I retrieve the accumulated sum ?
> >
> > Bruno
> >
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-Cafe at haskell.org(mailto: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/20160615/12ddc129/attachment.html>
More information about the Haskell-Cafe
mailing list