HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulererebase-1.21.2Haskell2010

Data.Text.Lazy.Builder

  • 2 types
  • 7 values
  • Packagererebase-1.21.2
  • Exports9
  • LanguageHaskell2010
  • LicenceMIT
  • SourceBuilder.hs
newtypenewtype Builder
#

A Builder is an efficient way to build lazy Text values. There are several functions for constructing builders, but only one to inspect them: to extract any data, you have to turn them into lazy Text values using toLazyText.

Internally, a builder constructs a lazy Text by filling arrays piece by piece. As each buffer is filled, it is 'popped' off, to become a new chunk of the resulting lazy Text. All this is hidden from the user of the Builder.

Instances6Eq, Ord, Show, IsString, Semigroup, Monoid
  • Eq BuilderDefined in text-2.1.3 · Data.Text.Internal.Builder
  • Ord BuilderDefined in text-2.1.3 · Data.Text.Internal.Builder
  • Show BuilderDefined in text-2.1.3 · Data.Text.Internal.Builder
  • IsString BuilderDefined in text-2.1.3 · Data.Text.Internal.Builder

    Performs replacement on invalid scalar values:

    Example2 expressions
    :set -XOverloadedStrings"\55555" :: Builder"\65533"
  • Semigroup BuilderDefined in text-2.1.3 · Data.Text.Internal.Builder
  • Monoid BuilderDefined in text-2.1.3 · Data.Text.Internal.Builder
valueflush :: Builder
#

O(1). Pop the strict Text we have constructed so far, if any, yielding a new chunk in the result lazy Text.

valuetoLazyText :: Builder -> Text
#

O(n). Extract a lazy Text from a Builder with a default buffer size. The construction work takes place if and when the relevant part of the lazy Text is demanded.

valuetoLazyTextWith :: Int -> Builder -> Text
#

O(n). Extract a lazy Text from a Builder, using the given size for the initial buffer. The construction work takes place if and when the relevant part of the lazy Text is demanded.

If the initial buffer is too small to hold all data, subsequent buffers will be the default buffer size.