/usr/share/doc/libghc-text-doc/html/Data-Text-Internal-Builder.html is in libghc-text-doc 1.2.2.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Data.Text.Internal.Builder</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Data-Text-Internal-Builder.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-Text-Internal-Builder.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">text-1.2.2.0: An efficient packed Unicode text type.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Copyright</th><td>(c) 2013 Bryan O'Sullivan
(c) 2010 Johan Tibell</td></tr><tr><th>License</th><td>BSD3-style (see LICENSE)</td></tr><tr><th>Maintainer</th><td>Johan Tibell <johan.tibell@gmail.com></td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Portability</th><td>portable to Hugs and GHC</td></tr><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Data.Text.Internal.Builder</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Public API</a><ul><li><a href="#g:2">The Builder type</a></li><li><a href="#g:3">Constructing Builders</a></li><li><a href="#g:4">Flushing the buffer state</a></li></ul></li><li><a href="#g:5">Internal functions</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p><em>Warning</em>: 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!</p><p>Efficient construction of lazy <code>Text</code> values. The principal
operations on a <code>Builder</code> are <code>singleton</code>, <code>fromText</code>, and
<code>fromLazyText</code>, which construct new builders, and <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#v:mappend">mappend</a></code>, which
concatenates two builders.</p><p>To get maximum performance when building lazy <code>Text</code> values using a
builder, associate <code>mappend</code> calls to the right. For example,
prefer</p><pre>singleton 'a' `mappend` (singleton 'b' `mappend` singleton 'c')</pre><p>to</p><pre>singleton 'a' `mappend` singleton 'b' `mappend` singleton 'c'</pre><p>as the latter associates <code>mappend</code> to the left.</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:Builder">Builder</a></li><li class="src short"><a href="#v:toLazyText">toLazyText</a> :: <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:toLazyTextWith">toLazyTextWith</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:singleton">singleton</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:fromText">fromText</a> :: <a href="Data-Text.html#t:Text">Text</a> -> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:fromLazyText">fromLazyText</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:fromString">fromString</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a> -> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:flush">flush</a> :: <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:append-39-">append'</a> :: <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a> -> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a> -> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:ensureFree">ensureFree</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:writeN">writeN</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> -> (<span class="keyword">forall</span> s. <a href="Data-Text-Array.html#t:MArray">MArray</a> s -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad-ST.html#t:ST">ST</a> s ()) -> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a></li></ul></div><div id="interface"><h1 id="g:1">Public API</h1><h2 id="g:2">The Builder type</h2><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Builder" class="def">Builder</a> <a href="src/Data-Text-Internal-Builder.html#Builder" class="link">Source</a></p><div class="doc"><p>A <code>Builder</code> is an efficient way to build lazy <code>Text</code> 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 <code>Text</code> values using <code>toLazyText</code>.</p><p>Internally, a builder constructs a lazy <code>Text</code> by filling arrays
piece by piece. As each buffer is filled, it is 'popped' off, to
become a new chunk of the resulting lazy <code>Text</code>. All this is
hidden from the user of the <code>Builder</code>.</p></div><div class="subs instances"><p id="control.i:Builder" class="caption collapser" onclick="toggleSection('i:Builder')">Instances</p><div id="section.i:Builder" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a></span> <a href="src/Data-Text-Internal-Builder.html#line-120" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Ord.html#t:Ord">Ord</a> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a></span> <a href="src/Data-Text-Internal-Builder.html#line-123" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#t:Show">Show</a> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a></span> <a href="src/Data-Text-Internal-Builder.html#line-117" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:IsString">IsString</a> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a></span> <a href="src/Data-Text-Internal-Builder.html#line-113" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a></span> <a href="src/Data-Text-Internal-Builder.html#line-101" class="link">Source</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:toLazyText" class="def">toLazyText</a> :: <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Internal-Builder.html#toLazyText" class="link">Source</a></p><div class="doc"><p><em>O(n).</em> Extract a lazy <code>Text</code> from a <code>Builder</code> with a default
buffer size. The construction work takes place if and when the
relevant part of the lazy <code>Text</code> is demanded.</p></div></div><div class="top"><p class="src"><a name="v:toLazyTextWith" class="def">toLazyTextWith</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Internal-Builder.html#toLazyTextWith" class="link">Source</a></p><div class="doc"><p><em>O(n).</em> Extract a lazy <code>Text</code> from a <code>Builder</code>, using the given
size for the initial buffer. The construction work takes place if
and when the relevant part of the lazy <code>Text</code> is demanded.</p><p>If the initial buffer is too small to hold all data, subsequent
buffers will be the default buffer size.</p></div></div><h2 id="g:3">Constructing Builders</h2><div class="top"><p class="src"><a name="v:singleton" class="def">singleton</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a> <a href="src/Data-Text-Internal-Builder.html#singleton" class="link">Source</a></p><div class="doc"><p><em>O(1).</em> A <code>Builder</code> taking a single character, satisfying</p><ul><li><pre><code><a href="Data-Text-Internal-Builder.html#v:toLazyText">toLazyText</a></code> (<code><a href="Data-Text-Internal-Builder.html#v:singleton">singleton</a></code> c) = <code><a href="Data-Text-Lazy.html#v:singleton">singleton</a></code> c</pre></li></ul></div></div><div class="top"><p class="src"><a name="v:fromText" class="def">fromText</a> :: <a href="Data-Text.html#t:Text">Text</a> -> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a> <a href="src/Data-Text-Internal-Builder.html#fromText" class="link">Source</a></p><div class="doc"><p><em>O(1).</em> A <code>Builder</code> taking a <code><a href="Data-Text.html#t:Text">Text</a></code>, satisfying</p><ul><li><pre><code><a href="Data-Text-Internal-Builder.html#v:toLazyText">toLazyText</a></code> (<code><a href="Data-Text-Internal-Builder.html#v:fromText">fromText</a></code> t) = <code><a href="Data-Text-Lazy.html#v:fromChunks">fromChunks</a></code> [t]</pre></li></ul></div></div><div class="top"><p class="src"><a name="v:fromLazyText" class="def">fromLazyText</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a> <a href="src/Data-Text-Internal-Builder.html#fromLazyText" class="link">Source</a></p><div class="doc"><p><em>O(1).</em> A <code>Builder</code> taking a lazy <code>Text</code>, satisfying</p><ul><li><pre><code><a href="Data-Text-Internal-Builder.html#v:toLazyText">toLazyText</a></code> (<code><a href="Data-Text-Internal-Builder.html#v:fromLazyText">fromLazyText</a></code> t) = t</pre></li></ul></div></div><div class="top"><p class="src"><a name="v:fromString" class="def">fromString</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a> -> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a> <a href="src/Data-Text-Internal-Builder.html#fromString" class="link">Source</a></p><div class="doc"><p><em>O(1).</em> A Builder taking a <code>String</code>, satisfying</p><ul><li><pre><code><a href="Data-Text-Internal-Builder.html#v:toLazyText">toLazyText</a></code> (<code><a href="Data-Text-Internal-Builder.html#v:fromString">fromString</a></code> s) = <code><a href="Data-Text-Lazy.html#v:fromChunks">fromChunks</a></code> [S.pack s]</pre></li></ul></div></div><h2 id="g:4">Flushing the buffer state</h2><div class="top"><p class="src"><a name="v:flush" class="def">flush</a> :: <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a> <a href="src/Data-Text-Internal-Builder.html#flush" class="link">Source</a></p><div class="doc"><p><em>O(1).</em> Pop the strict <code>Text</code> we have constructed so far, if any,
yielding a new chunk in the result lazy <code>Text</code>.</p></div></div><h1 id="g:5">Internal functions</h1><div class="top"><p class="src"><a name="v:append-39-" class="def">append'</a> :: <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a> -> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a> -> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a> <a href="src/Data-Text-Internal-Builder.html#append%27" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:ensureFree" class="def">ensureFree</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a> <a href="src/Data-Text-Internal-Builder.html#ensureFree" class="link">Source</a></p><div class="doc"><p>Ensure that there are at least <code>n</code> many elements available.</p></div></div><div class="top"><p class="src"><a name="v:writeN" class="def">writeN</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> -> (<span class="keyword">forall</span> s. <a href="Data-Text-Array.html#t:MArray">MArray</a> s -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad-ST.html#t:ST">ST</a> s ()) -> <a href="Data-Text-Internal-Builder.html#t:Builder">Builder</a> <a href="src/Data-Text-Internal-Builder.html#writeN" class="link">Source</a></p><div class="doc"><p>Ensure that <code>n</code> many elements are available, and then use <code>f</code> to
write some elements into the memory.</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>
|