Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
A mutable vector that grows in size.
Example usage:
import qualified Data.ProtoLens.Encoding.Growing as Growing import qualified Data.Vector.Unboxed as V test :: IO (V.Vector Int) test = do v <- Growing.new v' <- Growing.append v 1 v'' <- Growing.append v' 2 v''' <- Growing.append v'' 3 unsafeFreeze v'''
Documentation
new :: (PrimMonad m, Vector v a) => m (Growing v (PrimState m) a) Source #
Create a new empty growing vector.
append :: (PrimMonad m, Vector v a) => Growing v (PrimState m) a -> a -> m (Growing v (PrimState m) a) Source #
Returns a new growing vector with a new element at the end.
Note that the return value may share storage with the input value.
Furthermore, calling append
twice on the same input may result
in two vectors that share the same storage.