<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>

Thanks. That makes sense.<div>Grant<br><br><div><div id="ecxSkyDrivePlaceholder"></div>&gt; From: michael@snoyman.com<br>&gt; Date: Mon, 5 Mar 2012 16:56:11 +0200<br>&gt; Subject: Re: [Haskell-cafe] Conduit Sink fork<br>&gt; To: thelff@hotmail.com<br>&gt; CC: haskell-cafe@haskell.org<br>&gt; <br>&gt; On Mon, Mar 5, 2012 at 1:54 AM, t helfferich &lt;thelff@hotmail.com&gt; wrote:<br>&gt; &gt; Hi!<br>&gt; &gt; So, it&nbsp;turns out I have a need for a sink that forks input into two other<br>&gt; &gt; sinks using the Conduit package.&nbsp;Here is what I came up<br>&gt; &gt; with:&nbsp;https://gist.github.com/1975383<br>&gt; &gt;<br>&gt; &gt; Is this the right way to write it?&nbsp;Also, what left over value(s) should I<br>&gt; &gt; return in the Done constructor?<br>&gt; &gt;<br>&gt; &gt; I appreciate any help you can give me.<br>&gt; &gt;<br>&gt; &gt; Thanks so much,<br>&gt; &gt; Grant<br>&gt; &gt;<br>&gt; &gt; _______________________________________________<br>&gt; &gt; Haskell-Cafe mailing list<br>&gt; &gt; Haskell-Cafe@haskell.org<br>&gt; &gt; http://www.haskell.org/mailman/listinfo/haskell-cafe<br>&gt; &gt;<br>&gt; <br>&gt; It looks like the right approach to me. What to do with the leftover<br>&gt; values is a really good question, and I don't think there's really an<br>&gt; obvious answer. I can think of a few approaches:<br>&gt; <br>&gt; * What you've done: never return leftover values.<br>&gt; * Always return the ll (or rr).<br>&gt; * Return whichever leftover value is Just, or if both are Just,<br>&gt; arbitrarily choosing one of them<br>&gt; <br>&gt; Similarly, you could take different approaches to what to do when<br>&gt; processing terminates early:<br>&gt; <br>&gt; * What you've done: continue pushing data until both Sinks return Done<br>&gt; * Terminate whenever the left (or right) Sink returns Done<br>&gt; * Terminate when *either* returns Done<br>&gt; <br>&gt; Again, there's no right answer here, they all seem like valid approaches.<br>&gt; <br>&gt; Michael<br></div></div>                                               </div></body>
</html>