[Haskell-cafe] ANN: vector-buffer package 0.1
lrpalmer at gmail.com
Tue Feb 15 05:08:17 CET 2011
This interface is an outlaw.
main = do
buf <- newBuffer 10 :: IO (Buffer Int)
pushNextElement buf 1
let v1 = V.toList (toVector buf)
v2 = V.toList (toVector buf)
pushNextElement buf 2
Despite v1 and v2 being defined to equal the exact same thing, this
program prints two distinct lines.
toVector depends on the current state of the buffer. If this is to be
a law-abiding interface, toVector must return a value in IO:
toVector :: (Storable a) => Buffer a -> IO (Vector a)
On Mon, Feb 14, 2011 at 7:28 PM, Alexander McPhail
<haskell.vivian.mcphail at gmail.com> wrote:
> I have uploaded a small package, vector-buffer, to hackage. It provides a
> buffer that can be turned into a Data.Vector.Storable. The mapM* functions
> map from the oldest element, not the first. Similarly for the derived
> Feature requests etc. welcome.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe