niagra-0.2.0: CSS EDSL for Haskell

Copyright(c) Nathaniel Symer, 2015
LicenseMIT
Maintainernate@symer.io
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Data.Niagra.Builder

Description

Lazy/Eager Text builder built on top of text technologies using better data structures than the original Builder.

It uses the Seq data structure to hold chunks rather than a List, because Seqs have O(1) access to either end of the structure. This is crucial for accumulating chunks in as little time possible.

Furthermore, this builder only copies a given sequence of bytes at most once: from a Text,String, or Char to a buffer.

Synopsis

Documentation

singleton :: Char -> Builder Source

O(1) create a Builder from a single Char.

fromString :: String -> Builder Source

O(1) create a Builder from a String.

fromText :: Text -> Builder Source

O(1) create a Builder from a Text.

fromLazyText :: Text -> Builder Source

O(1) create a Builder from a lazy Text.

toText :: Builder -> Text Source

O(n) Turn a Builder into a Text. While singleton, fromString, fromText, empty, and appendBuilder don't do any direct processing, the function they construct gets evaluated here. n is the length of the accumulated data to be built into a Text

toLazyText :: Builder -> Text Source

Lazy version of toText.