
I've released a small (one-module) library [1] inspired by functions in Data.Conduit.List like sourceList, consumeList, and take. The most recent (by a few days) depends on conduit-0.3.*, but vector-conduit-0.2.1.0 depends on conduit-0.2.*. Notably, however, the two have different APIs (0.3 has an API more consistent with other vector operations). Use of any versions below 0.2.1 is discouraged as consumeVector is notably less efficient since in those versions it relies on a dlist. This should be useful for replacing consumeList with consumeVector, since consumeVector is much more efficient for reading in a large amount of values with, at this point, very little code overhead for using a Vector rather than a list. The library uses Data.Vector.Generic so unboxed, boxed, immutable, and mutable vectors are all supported, along with conduits for converting between mutable and immutable. [1] http://hackage.haskell.org/package/vector-conduit-0.3.0.0

Nice package! An idea for sourceVector is to use the streaming interface [1]. It would be nice if GHC could fuse the array with sourceVector, avoiding to produce the array in the first place, but I'm not going to hold my breath =). Cheers, [1] http://hackage.haskell.org/packages/archive/vector/0.9.1/doc/html/Data-Vecto... -- Felipe.

On Thu, Mar 22, 2012 at 06:16:39PM -0300, Felipe Almeida Lessa wrote:
From: Felipe Almeida Lessa
To: Jared Hance Cc: haskell-cafe@haskell.org Date: Thu, 22 Mar 2012 18:16:39 -0300 Subject: Re: [Haskell-cafe] [ANNOUNCE] vector-conduit Nice package!
An idea for sourceVector is to use the streaming interface [1]. It would be nice if GHC could fuse the array with sourceVector, avoiding to produce the array in the first place, but I'm not going to hold my breath =).
I looked over it and decided to simply go with head/tail (not sure why I used the index thing... head/tail is so much more "functional"). That should still get some fusion benefit, right, since it all uses streams under the hood?

On Thu, Mar 22, 2012 at 8:03 PM, Jared Hance
I looked over it and decided to simply go with head/tail (not sure why I used the index thing... head/tail is so much more "functional"). That should still get some fusion benefit, right, since it all uses streams under the hood?
I'm almost sure that it won't fuse using head and tail, but YMMV. Cheers, -- Felipe.

On Thu, Mar 22, 2012 at 07:31:18PM -0300, Felipe Almeida Lessa wrote:
From: Felipe Almeida Lessa
To: haskell-cafe@haskell.org Date: Thu, 22 Mar 2012 19:31:18 -0300 Subject: Re: [Haskell-cafe] [ANNOUNCE] vector-conduit On Thu, Mar 22, 2012 at 8:03 PM, Jared Hance
wrote: I looked over it and decided to simply go with head/tail (not sure why I used the index thing... head/tail is so much more "functional"). That should still get some fusion benefit, right, since it all uses streams under the hood?
I'm almost sure that it won't fuse using head and tail, but YMMV.
Okay then. I just implemented the stream version; its at the git repository but I probably won't release for a few more days since I want to expand the testsuite.
participants (2)
-
Felipe Almeida Lessa
-
Jared Hance