-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Builders for arrays -- -- Builders for arrays @package array-builder @version 0.1.2.0 module Data.Builder -- | Builder for an array of boxed elements. newtype Builder a Builder :: (forall s. SmallMutableArray# s a -> Int# -> Int# -> Chunks a -> State# s -> (# State# s, SmallMutableArray# s a, Int#, Int#, Chunks a #)) -> Builder a cons :: a -> Builder a -> Builder a -- | A builder with one element. singleton :: a -> Builder a -- | A builder with two elements. doubleton :: a -> a -> Builder a -- | A builder with three elements. tripleton :: a -> a -> a -> Builder a run :: Builder a -> Chunks a instance GHC.Base.Monoid (Data.Builder.Builder a) instance GHC.Base.Semigroup (Data.Builder.Builder a) -- | Data.Builder.Bytes specialized to Bytes. module Data.Builder.Catenable.Bytes data Builder Empty :: Builder Cons :: {-# UNPACK #-} !Bytes -> !Builder -> Builder Snoc :: !Builder -> {-# UNPACK #-} !Bytes -> Builder Append :: !Builder -> !Builder -> Builder pattern (:<) :: Bytes -> Builder -> Builder infixr 5 :< pattern (:>) :: Builder -> Bytes -> Builder infixl 5 :> run :: Builder -> Chunks instance GHC.Base.Monoid Data.Builder.Catenable.Bytes.Builder instance GHC.Base.Semigroup Data.Builder.Catenable.Bytes.Builder -- | Data.Builder.Catenable specialized to ShortText. module Data.Builder.Catenable.Text data Builder Empty :: Builder Cons :: !ShortText -> !Builder -> Builder Snoc :: !Builder -> !ShortText -> Builder Append :: !Builder -> !Builder -> Builder pattern (:<) :: ShortText -> Builder -> Builder infixr 5 :< pattern (:>) :: Builder -> ShortText -> Builder infixl 5 :> -- | The result is chunks, but this is guaranteed to be UTF-8 encoded text, -- so if needed, you can flatten out the chunks and convert back to -- ShortText. run :: Builder -> Chunks instance Data.String.IsString Data.Builder.Catenable.Text.Builder instance GHC.Base.Monoid Data.Builder.Catenable.Text.Builder instance GHC.Base.Semigroup Data.Builder.Catenable.Text.Builder module Data.Builder.ST -- | Builder for an array of boxed elements. This type is appropriate when -- constructing an array of unknown size in an effectful (ST or -- IO) setting. In a non-effectful setting, consider the -- Builder from Data.Builder instead. -- -- A Builder must be used linearly. The type system does not -- enforce this, so users must be careful when handling a Builder. data Builder s a Builder :: !SmallMutableArray s a -> !Int -> !Int -> !Chunks a -> Builder s a -- | Create a new Builder with no elements in it. new :: ST s (Builder s a) -- | Create a new Builder with a single element. Useful when builder -- creation is immidiately followed by push. Note that: -- --
-- new >>= push x ≡ new1 x ---- -- But new1 performs slightly better. new1 :: a -> ST s (Builder s a) -- | Push an element onto the end of the builder. This is not strict in the -- element, so force it before pushing it on to the builder if doing so -- is needed to prevent space leaks. push :: a -> Builder s a -> ST s (Builder s a) -- | Convert a Builder to Chunks. The Builder must not -- be reused after this operation. freeze :: Builder s a -> ST s (Chunks a) -- | Builder with cheap concatenation. Like the builder type from -- Data.Builder.ST, this builder can be stored somewhere and -- this used again later. However, this builder type has several -- advantages: -- --