On Fri, Feb 1, 2013 at 8:42 AM, Simon Marechal <simon@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@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