[Haskell-cafe] Yet another Conduit question

Simon Marechal simon at banquise.net
Fri Feb 1 07:42:27 CET 2013


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.



More information about the Haskell-Cafe mailing list