vector-conduit-0.5.0.0: Conduit utilities for vectors

Safe HaskellNone

Data.Conduit.Vector

Synopsis

Documentation

sourceVector :: (Monad m, Vector v a) => v a -> Source m aSource

Use an immutable vector as a source.

sourceMVector :: (PrimMonad m, MVector v a) => v (PrimState m) a -> Source m aSource

Use a mutable vector as a source in the ST or IO monad.

consumeVector :: (PrimMonad m, Vector v a) => Sink a m (v a)Source

Consumes all values from the stream and return as an immutable vector. Due to the way it operates, it requires the ST monad at the minimum, although it can also operate IO. This is due to its dependency on a mutable vector.

consumeMVector :: (PrimMonad m, MVector v a) => Sink a m (v (PrimState m) a)Source

Consumes all values from the stream and returns as a mutable vector.

takeVector :: (PrimMonad m, Vector v a) => Int -> Sink a m (v a)Source

Consumes the first n values from a source and returns as an immutable vector.

takeMVector :: (PrimMonad m, MVector v a) => Int -> Sink a m (v (PrimState m) a)Source

Consumes the first n values from the stream and returns as a mutable vector.

thawConduit :: (PrimMonad m, Vector v a) => Conduit (v a) m (Mutable v (PrimState m) a)Source

Conduit which thaws immutable vectors into mutable vectors

freezeConduit :: (PrimMonad m, Vector v a) => Conduit (Mutable v (PrimState m) a) m (v a)Source

Conduit which freezes mutable vectors into immutable vectors