text-2.0.2: An efficient packed Unicode text type.

License | BSD-style (see LICENSE)
Stability | experimental
Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.Text.Internal.StrictBuilder

Contents

- Unsafe

Description

Warning: this is an internal module, and does not have a stable API or name. Functions in this module may not check or enforce preconditions expected by public modules. Use at your own risk!

Since: text-2.0.2

Synopsis

- data StrictBuilder = StrictBuilder {
  - sbLength :: !Int
  - sbWrite :: forall s. MArray s -> Int -> ST s ()
  }
- toText :: StrictBuilder -> Text
- fromChar :: Char -> StrictBuilder
- fromText :: Text -> StrictBuilder
- unsafeFromByteString :: ByteString -> StrictBuilder
- unsafeFromWord8 :: Word8 -> StrictBuilder

# Documentation

data StrictBuilder Source #

A delayed representation of strict `Text`.

Since: text-2.0.2

Constructors

StrictBuilder |

Fields

- sbLength :: !Int
- sbWrite :: forall s. MArray s -> Int -> ST s ()

#### Instances

Instances details

Monoid StrictBuilder Source # |
Instance details Defined in Data.Text.Internal.StrictBuilder Methods mempty :: StrictBuilder Source # mappend :: StrictBuilder -> StrictBuilder -> StrictBuilder Source # mconcat :: [StrictBuilder] -> StrictBuilder Source #
Semigroup StrictBuilder Source # | Concatenation of `StrictBuilder` is right-biased: the right builder will be run first. This allows a builder to run tail-recursively when it was accumulated left-to-right.
Instance details Defined in Data.Text.Internal.StrictBuilder Methods (<>) :: StrictBuilder -> StrictBuilder -> StrictBuilder Source # sconcat :: NonEmpty StrictBuilder -> StrictBuilder Source # stimes :: Integral b => b -> StrictBuilder -> StrictBuilder Source #

toText :: StrictBuilder -> Text Source #

Use `StrictBuilder` to build `Text`.

Since: text-2.0.2

fromChar :: Char -> StrictBuilder Source #

Since: text-2.0.2

fromText :: Text -> StrictBuilder Source #

Copy `Text` in a `StrictBuilder`

Since: text-2.0.2

# Unsafe

For internal purposes, we abuse `StrictBuilder` as a delayed `Array` rather than `Text`: it may not actually be valid `Text`.

unsafeFromByteString :: ByteString -> StrictBuilder Source #

Copy a `ByteString`.

Unsafe: This may not be valid UTF-8 text.

Since: text-2.0.2

unsafeFromWord8 :: Word8 -> StrictBuilder Source #

Unsafe: This may not be valid UTF-8 text.

Since: text-2.0.2