    -- |
    -- Extensions to the standard immutable Vector API.
    module VectorBuilder.Vector where

    import Data.Vector.Generic
    import qualified VectorBuilder.Core.Builder as A
    import qualified VectorBuilder.MVector as B
    import VectorBuilder.Prelude

    -- |
    -- Construct an immutable vector from a builder.
    --
    -- Supports all kinds of vectors: boxed, unboxed, primitive, storable.
    {-# INLINE build #-}
    build :: (Vector vector element) => A.Builder element -> vector element
    build :: forall (vector :: * -> *) element.
    Vector vector element =>
    Builder element -> vector element
    build Builder element
    builder =
      (forall s. ST s (vector element)) -> vector element
    forall a. (forall s. ST s a) -> a
    runST (Builder element -> ST s (Mutable vector s element)
    forall (vector :: * -> * -> *) element s.
    MVector vector element =>
    Builder element -> ST s (vector s element)
    B.build Builder element
    builder ST s (Mutable vector s element)
    -> (Mutable vector s element -> ST s (vector element))
    -> ST s (vector element)
    forall a b. ST s a -> (a -> ST s b) -> ST s b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Mutable vector s element -> ST s (vector element)
    Mutable vector (PrimState (ST s)) element -> ST s (vector element)
    forall (m :: * -> *) (v :: * -> *) a.
    (PrimMonad m, Vector v a) =>
    Mutable v (PrimState m) a -> m (v a)
    unsafeFreeze)