HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleproto-lens-0.7.1.5Haskell2010

Data.ProtoLens.Encoding.Growing

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'''
  • 2 types
  • 3 values
datadata Growing (v :: Type -> Type) s a
#

A mutable vector which can increase in capacity.

valueappend
  1. :: (PrimMonad m, Vector v a)
  2. => Growing v (PrimState m) a
  3. -> a
  4. -> m (Growing v (PrimState m) a)
#

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.

valueunsafeFreeze
  1. :: (PrimMonad m, Vector v a)
  2. => Growing v (PrimState m) a
  3. -> m (v a)
#

Unsafely convert a growing vector to an immutable one without copying. After this call, you may not use the growing vector nor any other growing vectors that were used to produce this one.

datadata RealWorld
#

RealWorld is deeply magical. It is primitive, but it is not unlifted (hence ptrArg). We never manipulate values of type RealWorld; it's only used in the type system, to parameterise State#.