/usr/share/doc/libghc-cereal-doc/html/Data-Serialize-Builder.html is in libghc-cereal-doc 0.4.1.1-4.
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 | <!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.Serialize.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-Serialize-Builder.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-Serialize-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">cereal-0.4.1.1: A binary serialization library</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Copyright</th><td>Lennart Kolmodin, Ross Paterson, Galois Inc. 2009</td></tr><tr><th>License</th><td>BSD3-style (see LICENSE)</td></tr><tr><th>Maintainer</th><td>Trevor Elliott <trevor@galois.com></td></tr><tr><th>Stability</th><td>Portability :</td></tr><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Data.Serialize.Builder</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">The Builder type</a></li><li><a href="#g:2">Constructing Builders</a></li><li><a href="#g:3">Flushing the buffer state</a></li><li><a href="#g:4">Derived Builders</a><ul><li><a href="#g:5">Big-endian writes</a></li><li><a href="#g:6">Little-endian writes</a></li><li><a href="#g:7">Host-endian, unaligned writes</a></li></ul></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Efficient construction of lazy bytestrings.</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:toByteString">toByteString</a> :: <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:toLazyByteString">toLazyByteString</a> :: <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:empty">empty</a> :: <a href="Data-Serialize-Builder.html#t:Builder">Builder</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-Word.html#t:Word8">Word8</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:append">append</a> :: <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:fromByteString">fromByteString</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:fromLazyByteString">fromLazyByteString</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:flush">flush</a> :: <a href="Data-Serialize-Builder.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:putWord16be">putWord16be</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word16">Word16</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:putWord32be">putWord32be</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word32">Word32</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:putWord64be">putWord64be</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word64">Word64</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:putWord16le">putWord16le</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word16">Word16</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:putWord32le">putWord32le</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word32">Word32</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:putWord64le">putWord64le</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word64">Word64</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:putWordhost">putWordhost</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word">Word</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:putWord16host">putWord16host</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word16">Word16</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:putWord32host">putWord32host</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word32">Word32</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a></li><li class="src short"><a href="#v:putWord64host">putWord64host</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word64">Word64</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a></li></ul></div><div id="interface"><h1 id="g:1">The Builder type</h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Builder" class="def">Builder</a> <a href="src/Data-Serialize-Builder.html#Builder" class="link">Source</a></p><div class="doc"><p>A <code><a href="Data-Serialize-Builder.html#t:Builder">Builder</a></code> is an efficient way to build lazy <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></code>s.
There are several functions for constructing <code><a href="Data-Serialize-Builder.html#t:Builder">Builder</a></code>s, but only one
to inspect them: to extract any data, you have to turn them into lazy
<code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></code>s using <code><a href="Data-Serialize-Builder.html#v:toLazyByteString">toLazyByteString</a></code>.</p><p>Internally, a <code><a href="Data-Serialize-Builder.html#t:Builder">Builder</a></code> constructs a lazy <code><a href="L.html#v:Bytestring">Bytestring</a></code> by filling byte
arrays piece by piece. As each buffer is filled, it is 'popped'
off, to become a new chunk of the resulting lazy <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></code>.
All this is hidden from the user of the <code><a href="Data-Serialize-Builder.html#t:Builder">Builder</a></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-Monoid.html#t:Monoid">Monoid</a> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a></span> <a href="src/Data-Serialize-Builder.html#line-98" class="link">Source</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:toByteString" class="def">toByteString</a> :: <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Data-Serialize-Builder.html#toByteString" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:toLazyByteString" class="def">toLazyByteString</a> :: <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> <a href="src/Data-Serialize-Builder.html#toLazyByteString" class="link">Source</a></p><div class="doc"><p><em>O(n).</em> Extract a lazy <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></code> from a <code><a href="Data-Serialize-Builder.html#t:Builder">Builder</a></code>.
The construction work takes place if and when the relevant part of
the lazy <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></code> is demanded.</p></div></div><h1 id="g:2">Constructing Builders</h1><div class="top"><p class="src"><a name="v:empty" class="def">empty</a> :: <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> <a href="src/Data-Serialize-Builder.html#empty" class="link">Source</a></p><div class="doc"><p><em>O(1).</em> The empty Builder, satisfying</p><ul><li><pre><code><a href="Data-Serialize-Builder.html#v:toLazyByteString">toLazyByteString</a></code> <code><a href="Data-Serialize-Builder.html#v:empty">empty</a></code> = <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString-Lazy.html#v:empty">empty</a></code></pre></li></ul></div></div><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-Word.html#t:Word8">Word8</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> <a href="src/Data-Serialize-Builder.html#singleton" class="link">Source</a></p><div class="doc"><p><em>O(1).</em> A Builder taking a single byte, satisfying</p><ul><li><pre><code><a href="Data-Serialize-Builder.html#v:toLazyByteString">toLazyByteString</a></code> (<code><a href="Data-Serialize-Builder.html#v:singleton">singleton</a></code> b) = <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString-Lazy.html#v:singleton">singleton</a></code> b</pre></li></ul></div></div><div class="top"><p class="src"><a name="v:append" class="def">append</a> :: <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> <a href="src/Data-Serialize-Builder.html#append" class="link">Source</a></p><div class="doc"><p><em>O(1).</em> The concatenation of two Builders, an associative operation
with identity <code><a href="Data-Serialize-Builder.html#v:empty">empty</a></code>, satisfying</p><ul><li><pre><code><a href="Data-Serialize-Builder.html#v:toLazyByteString">toLazyByteString</a></code> (<code><a href="Data-Serialize-Builder.html#v:append">append</a></code> x y) = <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString-Lazy.html#v:append">append</a></code> (<code><a href="Data-Serialize-Builder.html#v:toLazyByteString">toLazyByteString</a></code> x) (<code><a href="Data-Serialize-Builder.html#v:toLazyByteString">toLazyByteString</a></code> y)</pre></li></ul></div></div><div class="top"><p class="src"><a name="v:fromByteString" class="def">fromByteString</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> <a href="src/Data-Serialize-Builder.html#fromByteString" class="link">Source</a></p><div class="doc"><p><em>O(1).</em> A Builder taking a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></code>, satisfying</p><ul><li><pre><code><a href="Data-Serialize-Builder.html#v:toLazyByteString">toLazyByteString</a></code> (<code><a href="Data-Serialize-Builder.html#v:fromByteString">fromByteString</a></code> bs) = <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString-Lazy.html#v:fromChunks">fromChunks</a></code> [bs]</pre></li></ul></div></div><div class="top"><p class="src"><a name="v:fromLazyByteString" class="def">fromLazyByteString</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> <a href="src/Data-Serialize-Builder.html#fromLazyByteString" class="link">Source</a></p><div class="doc"><p><em>O(1).</em> A Builder taking a lazy <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></code>, satisfying</p><ul><li><pre><code><a href="Data-Serialize-Builder.html#v:toLazyByteString">toLazyByteString</a></code> (<code><a href="Data-Serialize-Builder.html#v:fromLazyByteString">fromLazyByteString</a></code> bs) = bs</pre></li></ul></div></div><h1 id="g:3">Flushing the buffer state</h1><div class="top"><p class="src"><a name="v:flush" class="def">flush</a> :: <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> <a href="src/Data-Serialize-Builder.html#flush" class="link">Source</a></p><div class="doc"><p><em>O(1).</em> Pop the <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></code> we have constructed so far, if any,
yielding a new chunk in the result lazy <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></code>.</p></div></div><h1 id="g:4">Derived Builders</h1><h2 id="g:5">Big-endian writes</h2><div class="top"><p class="src"><a name="v:putWord16be" class="def">putWord16be</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word16">Word16</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> <a href="src/Data-Serialize-Builder.html#putWord16be" class="link">Source</a></p><div class="doc"><p>Write a Word16 in big endian format</p></div></div><div class="top"><p class="src"><a name="v:putWord32be" class="def">putWord32be</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word32">Word32</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> <a href="src/Data-Serialize-Builder.html#putWord32be" class="link">Source</a></p><div class="doc"><p>Write a Word32 in big endian format</p></div></div><div class="top"><p class="src"><a name="v:putWord64be" class="def">putWord64be</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word64">Word64</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> <a href="src/Data-Serialize-Builder.html#putWord64be" class="link">Source</a></p><div class="doc"><p>Write a Word64 in big endian format</p></div></div><h2 id="g:6">Little-endian writes</h2><div class="top"><p class="src"><a name="v:putWord16le" class="def">putWord16le</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word16">Word16</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> <a href="src/Data-Serialize-Builder.html#putWord16le" class="link">Source</a></p><div class="doc"><p>Write a Word16 in little endian format</p></div></div><div class="top"><p class="src"><a name="v:putWord32le" class="def">putWord32le</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word32">Word32</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> <a href="src/Data-Serialize-Builder.html#putWord32le" class="link">Source</a></p><div class="doc"><p>Write a Word32 in little endian format</p></div></div><div class="top"><p class="src"><a name="v:putWord64le" class="def">putWord64le</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word64">Word64</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> <a href="src/Data-Serialize-Builder.html#putWord64le" class="link">Source</a></p><div class="doc"><p>Write a Word64 in little endian format</p></div></div><h2 id="g:7">Host-endian, unaligned writes</h2><div class="top"><p class="src"><a name="v:putWordhost" class="def">putWordhost</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word">Word</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> <a href="src/Data-Serialize-Builder.html#putWordhost" class="link">Source</a></p><div class="doc"><p><em>O(1).</em> A Builder taking a single native machine word. The word is
written in host order, host endian form, for the machine you're on.
On a 64 bit machine the Word is an 8 byte value, on a 32 bit machine,
4 bytes. Values written this way are not portable to
different endian or word sized machines, without conversion.</p></div></div><div class="top"><p class="src"><a name="v:putWord16host" class="def">putWord16host</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word16">Word16</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> <a href="src/Data-Serialize-Builder.html#putWord16host" class="link">Source</a></p><div class="doc"><p>Write a Word16 in native host order and host endianness.
2 bytes will be written, unaligned.</p></div></div><div class="top"><p class="src"><a name="v:putWord32host" class="def">putWord32host</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word32">Word32</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> <a href="src/Data-Serialize-Builder.html#putWord32host" class="link">Source</a></p><div class="doc"><p>Write a Word32 in native host order and host endianness.
4 bytes will be written, unaligned.</p></div></div><div class="top"><p class="src"><a name="v:putWord64host" class="def">putWord64host</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Word.html#t:Word64">Word64</a> -> <a href="Data-Serialize-Builder.html#t:Builder">Builder</a> <a href="src/Data-Serialize-Builder.html#putWord64host" class="link">Source</a></p><div class="doc"><p>Write a Word64 in native host order.
On a 32 bit machine we write two host order Word32s, in big endian form.
8 bytes will be written, unaligned.</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>
|