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