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