<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection">Hello,<br />
Thanks for the answer.<br />
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 ?<br />
It's also a broader question, how to get the result of a ConduitM i o m r ?</div>
<div name="messageSignatureSection"><br />
bruno</div>
<div name="messageReplySection"><br />
On 15 Jun 2016 08:08 +0200, Baojun Wang <wangbj@gmail.com>, wrote:<br />
<blockquote type="cite">
<div style="white-space:pre-wrap">Foldl from conduit combinators?</div>
<br />
<div class="gmail_quote">
<div dir="ltr">On Tue, Jun 14, 2016 at 22:54 <<a href="mailto:bruno@ruomad.net">bruno@ruomad.net</a>> wrote:<br /></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div name="messageBodySection">Hello,<br />
I'm trying to use Data.Conduit, but I get stuck with mapAccum as how to get and retrieve the result.<br />
If I use it, I get a simple conduit like :<br />
<br />
testC :: ConduitM () Int IO Int<br />
testC = Src =$= cdt where<br />
src = CL.sourceList [1..10]<br />
cdt = CL.mapAccum (\x s -> (x+s, x) 0<br />
<br />
I can get the output with<br />
testC $$ CL.consume<br />
but how do I retrieve the accumulated sum ?<br />
<br />
Bruno</div>
<div name="messageSignatureSection"><br /></div>
</div>
_______________________________________________<br />
Haskell-Cafe mailing list<br />
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">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 /></blockquote>
</div>
</blockquote>
</div>
</body>
</html>