[Haskell-cafe] Yet another Conduit question

Michael Snoyman michael at snoyman.com
Fri Feb 1 08:21:15 CET 2013


On Fri, Feb 1, 2013 at 8:42 AM, Simon Marechal <simon at banquise.net> wrote:

> On 02/01/2013 05:21 AM, Michael Snoyman wrote:
> > Firstly, what's the use case that you want to deal with lists? If it's
> > for efficiency, you'd probably be better off using a Vector instead.
>
> That is a good point, and I wanted to go that way, but was not sure it
> would help me a lot here. My use case is for services where there is a
> "bulk"  API, such as Redis pipelining or Elasticsearch bulk inserts. The
> network round-trip gains would exceed by far those from a List to Vector
> conversion.
>
> > But I think the inverse of `concat` is `singleton =
> > Data.Conduit.List.map return`, or `awaitForever $ yield . return`, using
> > the list instance for Monad. Your conduitMap could be implemented then
> as:
> >
> >     conduitMap conduit = concat =$= conduit =$= singleton
>
> I can see how to do singleton, but that would gain me ... singletons.
> That means I could not exploit a bulk API.
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


So you're saying you want to keep the same grouping that you had
originally? Or do you want to batch up a certain number of results? There
are lots of ways of approaching this problem, and the types don't imply
nearly enough to determine what you're hoping to achieve here.

Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130201/1426ddab/attachment.htm>


More information about the Haskell-Cafe mailing list