[Haskell-cafe] Conduit Sink fork
t helfferich
thelff at hotmail.com
Mon Mar 5 20:51:17 CET 2012
Sorry for the repeat postings. My machine freaked out
> 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.
>
> Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120305/79da6478/attachment.htm>
More information about the Haskell-Cafe
mailing list