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


-- | Internals of "text-builder"
--   
--   Core functionality of "text-builder" with guts exposed for efficient
--   custom integrations.
--   
--   Consider this to be what you'll find in the "Internal" modules of
--   packages violating PVP. You'll find more on this in <a>a blog
--   post</a>.
@package text-builder-core
@version 0.1.1.1

module TextBuilderCore

-- | Composable specification of how to efficiently construct strict
--   <a>Text</a>.
--   
--   Provides instances of <a>Semigroup</a> and <a>Monoid</a>, which have
--   complexity of <i>O(1)</i>.
data TextBuilder
TextBuilder :: Int -> (forall s. () => MArray s -> Int -> ST s Int) -> TextBuilder

-- | Check whether the builder is empty.
isEmpty :: TextBuilder -> Bool

-- | Execute the builder producing a strict text.
toText :: TextBuilder -> Text

-- | Construct from a list of characters.
string :: String -> TextBuilder

-- | Strict text.
text :: Text -> TextBuilder

-- | Lazy text.
lazyText :: Text -> TextBuilder

-- | Unicode character.
char :: Char -> TextBuilder

-- | Safe Unicode codepoint with invalid values replaced by the <tt>�</tt>
--   char (codepoint <tt>0xfffd</tt>), which is the same as what
--   <tt>Data.Text.<a>pack</a></tt> does.
unicodeCodepoint :: Int -> TextBuilder

-- | Helper for constructing from char producers a bit more efficiently
--   than via <tt>(text . fromString)</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; unsafeChars 3 "123"
--   "123"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; unsafeChars 4 "123"
--   "123"
--   </pre>
unsafeChars :: Int -> [Char] -> TextBuilder

-- | Provides a unified way to deal with the byte array regardless of the
--   version of the <tt>text</tt> library.
--   
--   Keep in mind that prior to <tt>text-2.0</tt>, the array was operating
--   on <a>Word16</a> values due to the library abstracting over
--   <tt>UTF-16</tt>. Starting from <tt>text-2.0</tt>, the array operates
--   on <a>Word8</a> values and the library abstracts over <tt>UTF-8</tt>.
--   
--   This function is useful for building ASCII values.
--   
--   <pre>
--   &gt;&gt;&gt; unsafeSeptets 3 (fmap (+48) [1, 2, 3])
--   "123"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; unsafeSeptets 4 (fmap (+48) [1, 2, 3])
--   "123"
--   </pre>
unsafeSeptets :: Int -> [Word8] -> TextBuilder

-- | Same as <a>unsafeSeptets</a>, but writes the bytes in reverse order
--   and requires the size to be precise.
--   
--   <pre>
--   &gt;&gt;&gt; unsafeReverseSeptets 3 (fmap (+48) [1, 2, 3])
--   "321"
--   </pre>
unsafeReverseSeptets :: Int -> [Word8] -> TextBuilder
instance Test.QuickCheck.Arbitrary.Arbitrary TextBuilderCore.TextBuilder
instance GHC.Classes.Eq TextBuilderCore.TextBuilder
instance GHC.Internal.Data.String.IsString TextBuilderCore.TextBuilder
instance GHC.Internal.Base.Monoid TextBuilderCore.TextBuilder
instance GHC.Internal.Base.Semigroup TextBuilderCore.TextBuilder
instance GHC.Internal.Show.Show TextBuilderCore.TextBuilder
