-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Vector builder
--   
--   An API for efficient and convenient construction of vectors. It
--   provides the composable Builder abstraction, which has
--   instances of the Monoid and Semigroup classes.
--   
--   
--   
- Usage
--   
--   
--   First you use the Builder abstraction to specify the structure
--   of the vector. Then you execute the builder to actually produce the
--   vector.
--   
--   
--   
- Example
--   
--   
--   The following code shows how you can efficiently concatenate different
--   datastructures into a single immutable vector:
--   
--   
--   import qualified Data.Vector as A
--   import qualified VectorBuilder.Builder as B
--   import qualified VectorBuilder.Vector as C
--   
--   
--   myVector :: A.Vector a -> [a] -> a -> A.Vector a
--   myVector vector list element =
--     C.build builder
--     where
--       builder =
--         B.vector vector <>
--         B.foldable list <>
--         B.singleton element
--   
@package vector-builder
@version 0.3.8.6

-- | Extensions to the standard mutable Vector API.
module VectorBuilder.MVector

-- | Construct a mutable vector from a builder.
--   
--   Supports all kinds of vectors: boxed, unboxed, primitive, storable.
build :: MVector vector element => Builder element -> ST s (vector s element)

module VectorBuilder.Builder

-- | An abstraction over the size of a vector for the process of its
--   construction.
--   
--   It postpones the actual construction of a vector until the execution
--   of the builder.
data Builder element

-- | Empty builder.
empty :: Builder element

-- | Builder of a single element.
singleton :: element -> Builder element

-- | Gets the size of a Builder.
size :: Builder element -> Int

-- | Builder from an immutable vector of elements.
--   
--   Supports all kinds of vectors: boxed, unboxed, primitive, storable.
vector :: Vector vector element => vector element -> Builder element
foldable :: Foldable foldable => foldable element -> Builder element

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

-- | Construct an immutable vector from a builder.
--   
--   Supports all kinds of vectors: boxed, unboxed, primitive, storable.
build :: Vector vector element => Builder element -> vector element

-- | MonadPlus utilities. For instance, they can be applied with parsing
--   libraries.
module VectorBuilder.MonadPlus
many :: (MonadPlus m, Vector vector element) => m element -> m (vector element)
manyBuilder :: MonadPlus m => m element -> m (Builder element)
many1 :: (MonadPlus m, Vector vector element) => m element -> m (vector element)
sepBy :: (MonadPlus m, Vector vector element) => m element -> m separator -> m (vector element)
sepBy1 :: (MonadPlus m, Vector vector element) => m element -> m separator -> m (vector element)

-- | Alternative utilities. For instance, they can be applied with parsing
--   libraries.
module VectorBuilder.Alternative
many :: (Alternative m, Vector vector a) => m a -> m (vector a)
manyBuilder :: Alternative m => m a -> m (Builder a)
some :: (Alternative m, Vector vector a) => m a -> m (vector a)
someBuilder :: Alternative m => m a -> m (Builder a)
