Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 57479ab8bdd5c409ba20df41a34bbb71 > files > 9

ghc-zlib-bindings-devel-0.0.0-4.fc15.i686.rpm

<!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>Codec.Zlib</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_Codec-Zlib.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Codec-Zlib.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">zlib-bindings-0.0.0: Low-level bindings to the zlib package.</p></div><div id="content"><div id="module-header"><p class="caption">Codec.Zlib</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Inflate
</a></li><li><a href="#g:2">Deflate
</a></li><li><a href="#g:3">Data types
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>This is a middle-level wrapper around the zlib C API. It allows you to
 work fully with bytestrings and not touch the FFI at all, but is still
 low-level enough to allow you to implement high-level abstractions such as
 enumerators. Significantly, it does not use lazy IO.
</p><p>You'll probably need to reference the docs a bit to understand the
 WindowBits parameters below, but a basic rule of thumb is 15 is for zlib
 compression, and 31 for gzip compression.
</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:Inflate">Inflate</a> </li><li class="src short"><a href="#v:initInflate">initInflate</a> :: <a href="Codec-Zlib.html#t:WindowBits">WindowBits</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Codec-Zlib.html#t:Inflate">Inflate</a></li><li class="src short"><a href="#v:withInflateInput">withInflateInput</a> ::  <a href="Codec-Zlib.html#t:Inflate">Inflate</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a>) -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> a) -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> a</li><li class="src short"><a href="#v:finishInflate">finishInflate</a> :: <a href="Codec-Zlib.html#t:Inflate">Inflate</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><span class="keyword">data</span>  <a href="#t:Deflate">Deflate</a> </li><li class="src short"><a href="#v:initDeflate">initDeflate</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Codec-Zlib.html#t:WindowBits">WindowBits</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Codec-Zlib.html#t:Deflate">Deflate</a></li><li class="src short"><a href="#v:withDeflateInput">withDeflateInput</a> ::  <a href="Codec-Zlib.html#t:Deflate">Deflate</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a>) -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> a) -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> a</li><li class="src short"><a href="#v:finishDeflate">finishDeflate</a> ::  <a href="Codec-Zlib.html#t:Deflate">Deflate</a> -&gt; (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a>) -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> a) -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> a</li><li class="src short"><span class="keyword">data</span>  <a href="#t:WindowBits">WindowBits</a>  = <a href="#v:WindowBits">WindowBits</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:defaultWindowBits">defaultWindowBits</a> :: <a href="Codec-Zlib.html#t:WindowBits">WindowBits</a></li><li class="src short"><span class="keyword">data</span>  <a href="#t:ZlibException">ZlibException</a>  = <a href="#v:ZlibException">ZlibException</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></li></ul></div><div id="interface"><h1 id="g:1">Inflate
</h1><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:Inflate" class="def">Inflate</a>  <a href="src/Codec-Zlib.html#Inflate" class="link">Source</a></p><div class="doc"><p>The state of an inflation (eg, decompression) process. All allocated
 memory is automatically reclaimed by the garbage collector.
</p></div></div><div class="top"><p class="src"><a name="v:initInflate" class="def">initInflate</a> :: <a href="Codec-Zlib.html#t:WindowBits">WindowBits</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Codec-Zlib.html#t:Inflate">Inflate</a><a href="src/Codec-Zlib.html#initInflate" class="link">Source</a></p><div class="doc"><p>Initialize an inflation process with the given <code><a href="Codec-Zlib.html#t:WindowBits">WindowBits</a></code>. You will need
 to call <code><a href="Codec-Zlib.html#v:withInflateInput">withInflateInput</a></code> to feed compressed data to this and
 <code><a href="Codec-Zlib.html#v:finishInflate">finishInflate</a></code> to extract the final chunk of decompressed data.
</p></div></div><div class="top"><p class="src"><a name="v:withInflateInput" class="def">withInflateInput</a> ::  <a href="Codec-Zlib.html#t:Inflate">Inflate</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a>) -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> a) -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> a<a href="src/Codec-Zlib.html#withInflateInput" class="link">Source</a></p><div class="doc"><p>Feed the given <code><a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a></code> to the inflater. This function takes a
 function argument which takes a &quot;popper&quot;. A popper is an IO action that
 will return the next bit of inflated data, returning <code><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#v:Nothing">Nothing</a></code> when there is
 no more data to be popped.
</p><p>Note that this function automatically buffers the output to
 <code>defaultChunkSize</code>, and therefore you won't get any data from the popper
 until that much decompressed data is available. After you have fed all of
 the compressed data to this function, you can extract your final chunk of
 decompressed data using <code><a href="Codec-Zlib.html#v:finishInflate">finishInflate</a></code>.
</p></div></div><div class="top"><p class="src"><a name="v:finishInflate" class="def">finishInflate</a> :: <a href="Codec-Zlib.html#t:Inflate">Inflate</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a><a href="src/Codec-Zlib.html#finishInflate" class="link">Source</a></p><div class="doc"><p>As explained in <code><a href="Codec-Zlib.html#v:withInflateInput">withInflateInput</a></code>, inflation buffers your decompressed
 data. After you call <code><a href="Codec-Zlib.html#v:withInflateInput">withInflateInput</a></code> with your last chunk of compressed
 data, you will likely have some data still sitting in the buffer. This
 function will return it to you.
</p></div></div><h1 id="g:2">Deflate
</h1><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:Deflate" class="def">Deflate</a>  <a href="src/Codec-Zlib.html#Deflate" class="link">Source</a></p><div class="doc"><p>The state of a deflation (eg, compression) process. All allocated memory
 is automatically reclaimed by the garbage collector.
</p></div></div><div class="top"><p class="src"><a name="v:initDeflate" class="def">initDeflate</a><a href="src/Codec-Zlib.html#initDeflate" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></td><td class="doc"><p>Compression level
</p></td></tr><tr><td class="src">-&gt; <a href="Codec-Zlib.html#t:WindowBits">WindowBits</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">-&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Codec-Zlib.html#t:Deflate">Deflate</a></td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p>Initialize a deflation process with the given compression level and
 <code><a href="Codec-Zlib.html#t:WindowBits">WindowBits</a></code>. You will need to call <code><a href="Codec-Zlib.html#v:withDeflateInput">withDeflateInput</a></code> to feed uncompressed
 data to this and <code><a href="Codec-Zlib.html#v:finishDeflate">finishDeflate</a></code> to extract the final chunks of compressed
 data.
</p></div></div><div class="top"><p class="src"><a name="v:withDeflateInput" class="def">withDeflateInput</a> ::  <a href="Codec-Zlib.html#t:Deflate">Deflate</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a>) -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> a) -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> a<a href="src/Codec-Zlib.html#withDeflateInput" class="link">Source</a></p><div class="doc"><p>Feed the given <code><a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a></code> to the deflater. This function takes a
 function argument which takes a &quot;popper&quot;. A popper is an IO action that
 will return the next bit of deflated data, returning <code><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#v:Nothing">Nothing</a></code> when there is
 no more data to be popped.
</p><p>Note that this function automatically buffers the output to
 <code>defaultChunkSize</code>, and therefore you won't get any data from the popper
 until that much compressed data is available. After you have fed all of the
 decompressed data to this function, you can extract your final chunks of
 compressed data using <code><a href="Codec-Zlib.html#v:finishDeflate">finishDeflate</a></code>.
</p></div></div><div class="top"><p class="src"><a name="v:finishDeflate" class="def">finishDeflate</a> ::  <a href="Codec-Zlib.html#t:Deflate">Deflate</a> -&gt; (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a>) -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> a) -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> a<a href="src/Codec-Zlib.html#finishDeflate" class="link">Source</a></p><div class="doc"><p>As explained in <code><a href="Codec-Zlib.html#v:withDeflateInput">withDeflateInput</a></code>, deflation buffers your compressed
 data. After you call <code><a href="Codec-Zlib.html#v:withDeflateInput">withDeflateInput</a></code> with your last chunk of decompressed
 data, we need to flush the rest of the data waiting to be deflated. This
 function takes a function parameter which accepts a &quot;popper&quot;, just like
 <code><a href="Codec-Zlib.html#v:withDeflateInput">withDeflateInput</a></code>.
</p></div></div><h1 id="g:3">Data types
</h1><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:WindowBits" class="def">WindowBits</a>  </p><div class="doc"><p>This specifies the size of the compression window. Larger values of this
 parameter result in better compression at the expense of higher memory
 usage.
</p><p>The compression window size is the value of the the window bits raised to
 the power 2. The window bits must be in the range <code>8..15</code> which corresponds
 to compression window sizes of 256b to 32Kb. The default is 15 which is also
 the maximum size.
</p><p>The total amount of memory used depends on the window bits and the
 <code><a href="/usr/share/doc/ghc/html/libraries/zlib-0.5.3.1/Codec-Compression-Zlib-Internal.html#t:MemoryLevel">MemoryLevel</a></code>. See the <code><a href="/usr/share/doc/ghc/html/libraries/zlib-0.5.3.1/Codec-Compression-Zlib-Internal.html#t:MemoryLevel">MemoryLevel</a></code> for the details.
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:WindowBits" class="def">WindowBits</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div><div class="top"><p class="src"><a name="v:defaultWindowBits" class="def">defaultWindowBits</a> :: <a href="Codec-Zlib.html#t:WindowBits">WindowBits</a></p><div class="doc"><p>The default <code><a href="Codec-Zlib.html#t:WindowBits">WindowBits</a></code> is 15 which is also the maximum size.
</p></div></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:ZlibException" class="def">ZlibException</a>  <a href="src/Codec-Zlib.html#ZlibException" class="link">Source</a></p><div class="doc"><p>Exception that can be thrown from the FFI code. The parameter is the
 numerical error code from the zlib library. Quoting the zlib.h file
 directly:
</p><ul><li> #define Z_OK            0
</li><li> #define Z_STREAM_END    1
</li><li> #define Z_NEED_DICT     2
</li><li> #define Z_ERRNO        (-1)
</li><li> #define Z_STREAM_ERROR (-2)
</li><li> #define Z_DATA_ERROR   (-3)
</li><li> #define Z_MEM_ERROR    (-4)
</li><li> #define Z_BUF_ERROR    (-5)
</li><li> #define Z_VERSION_ERROR (-6)
</li></ul></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:ZlibException" class="def">ZlibException</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></td><td class="doc empty">&nbsp;</td></tr></table></div><div class="subs instances"><p id="control.i:ZlibException" class="caption collapser" onclick="toggleSection('i:ZlibException')">Instances</p><div id="section.i:ZlibException" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Text-Show.html#t:Show">Show</a> <a href="Codec-Zlib.html#t:ZlibException">ZlibException</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> <a href="Codec-Zlib.html#t:ZlibException">ZlibException</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Control-Exception-Base.html#t:Exception">Exception</a> <a href="Codec-Zlib.html#t:ZlibException">ZlibException</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.9.2</p></div></body></html>