Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 6ae69e5eca788d52d1d55e0ca5834ac8 > files > 22

ghc-zlib-devel-0.5.3.1-2.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.Compression.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-Compression-Zlib.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Codec-Compression-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-0.5.3.1: Compression and decompression in the gzip and zlib formats</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>portable (H98 + FFI)</td></tr><tr><th>Stability</th><td>provisional</td></tr><tr><th>Maintainer</th><td>duncan@haskell.org</td></tr></table><p class="caption">Codec.Compression.Zlib</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Simple compression and decompression
</a></li><li><a href="#g:2">Extended api with control over compression parameters
</a><ul><li><a href="#g:3">The compression parameter types
</a></li></ul></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Compression and decompression of data streams in the zlib format.
</p><p>The format is described in detail in RFC #1950:
 <a href="http://www.ietf.org/rfc/rfc1950.txt">http://www.ietf.org/rfc/rfc1950.txt</a>
</p><p>See also the zlib home page: <a href="http://zlib.net/">http://zlib.net/</a>
</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"><a href="#v:compress">compress</a> :: <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:decompress">decompress</a> :: <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:compressWith">compressWith</a> :: <a href="Codec-Compression-Zlib.html#t:CompressParams">CompressParams</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:decompressWith">decompressWith</a> :: <a href="Codec-Compression-Zlib.html#t:DecompressParams">DecompressParams</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><span class="keyword">data</span>  <a href="#t:CompressParams">CompressParams</a>  = <a href="#v:CompressParams">CompressParams</a> {<ul class="subs"><li><a href="#v:compressLevel">compressLevel</a> :: !<a href="Codec-Compression-Zlib.html#t:CompressionLevel">CompressionLevel</a></li><li><a href="#v:compressMethod">compressMethod</a> :: !<a href="Codec-Compression-Zlib.html#t:Method">Method</a></li><li><a href="#v:compressWindowBits">compressWindowBits</a> :: !<a href="Codec-Compression-Zlib.html#t:WindowBits">WindowBits</a></li><li><a href="#v:compressMemoryLevel">compressMemoryLevel</a> :: !<a href="Codec-Compression-Zlib.html#t:MemoryLevel">MemoryLevel</a></li><li><a href="#v:compressStrategy">compressStrategy</a> :: !<a href="Codec-Compression-Zlib.html#t:CompressionStrategy">CompressionStrategy</a></li><li><a href="#v:compressBufferSize">compressBufferSize</a> :: !<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></li></ul>}</li><li class="src short"><a href="#v:defaultCompressParams">defaultCompressParams</a> :: <a href="Codec-Compression-Zlib.html#t:CompressParams">CompressParams</a></li><li class="src short"><span class="keyword">data</span>  <a href="#t:DecompressParams">DecompressParams</a>  = <a href="#v:DecompressParams">DecompressParams</a> {<ul class="subs"><li><a href="#v:decompressWindowBits">decompressWindowBits</a> :: !<a href="Codec-Compression-Zlib.html#t:WindowBits">WindowBits</a></li><li><a href="#v:decompressBufferSize">decompressBufferSize</a> :: !<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></li></ul>}</li><li class="src short"><a href="#v:defaultDecompressParams">defaultDecompressParams</a> :: <a href="Codec-Compression-Zlib.html#t:DecompressParams">DecompressParams</a></li><li class="src short"><span class="keyword">data</span>  <a href="#t:CompressionLevel">CompressionLevel</a> <ul class="subs"><li>= <a href="#v:DefaultCompression">DefaultCompression</a>  </li><li>| <a href="#v:NoCompression">NoCompression</a>  </li><li>| <a href="#v:BestSpeed">BestSpeed</a>  </li><li>| <a href="#v:BestCompression">BestCompression</a>  </li><li>| <a href="#v:CompressionLevel">CompressionLevel</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a>  </li></ul></li><li class="src short"><a href="#v:defaultCompression">defaultCompression</a> :: <a href="Codec-Compression-Zlib.html#t:CompressionLevel">CompressionLevel</a></li><li class="src short"><a href="#v:noCompression">noCompression</a> :: <a href="Codec-Compression-Zlib.html#t:CompressionLevel">CompressionLevel</a></li><li class="src short"><a href="#v:bestSpeed">bestSpeed</a> :: <a href="Codec-Compression-Zlib.html#t:CompressionLevel">CompressionLevel</a></li><li class="src short"><a href="#v:bestCompression">bestCompression</a> :: <a href="Codec-Compression-Zlib.html#t:CompressionLevel">CompressionLevel</a></li><li class="src short"><a href="#v:compressionLevel">compressionLevel</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-Compression-Zlib.html#t:CompressionLevel">CompressionLevel</a></li><li class="src short"><span class="keyword">data</span>  <a href="#t:Method">Method</a>  = <a href="#v:Deflated">Deflated</a></li><li class="src short"><a href="#v:deflateMethod">deflateMethod</a> :: <a href="Codec-Compression-Zlib.html#t:Method">Method</a></li><li class="src short"><span class="keyword">data</span>  <a href="#t:WindowBits">WindowBits</a> <ul class="subs"><li>= <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>| <a href="#v:DefaultWindowBits">DefaultWindowBits</a>  </li></ul></li><li class="src short"><a href="#v:defaultWindowBits">defaultWindowBits</a> :: <a href="Codec-Compression-Zlib.html#t:WindowBits">WindowBits</a></li><li class="src short"><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> -&gt; <a href="Codec-Compression-Zlib.html#t:WindowBits">WindowBits</a></li><li class="src short"><span class="keyword">data</span>  <a href="#t:MemoryLevel">MemoryLevel</a> <ul class="subs"><li>= <a href="#v:DefaultMemoryLevel">DefaultMemoryLevel</a>  </li><li>| <a href="#v:MinMemoryLevel">MinMemoryLevel</a>  </li><li>| <a href="#v:MaxMemoryLevel">MaxMemoryLevel</a>  </li><li>| <a href="#v:MemoryLevel">MemoryLevel</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a>  </li></ul></li><li class="src short"><a href="#v:defaultMemoryLevel">defaultMemoryLevel</a> :: <a href="Codec-Compression-Zlib.html#t:MemoryLevel">MemoryLevel</a></li><li class="src short"><a href="#v:minMemoryLevel">minMemoryLevel</a> :: <a href="Codec-Compression-Zlib.html#t:MemoryLevel">MemoryLevel</a></li><li class="src short"><a href="#v:maxMemoryLevel">maxMemoryLevel</a> :: <a href="Codec-Compression-Zlib.html#t:MemoryLevel">MemoryLevel</a></li><li class="src short"><a href="#v:memoryLevel">memoryLevel</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-Compression-Zlib.html#t:MemoryLevel">MemoryLevel</a></li><li class="src short"><span class="keyword">data</span>  <a href="#t:CompressionStrategy">CompressionStrategy</a> <ul class="subs"><li>= <a href="#v:DefaultStrategy">DefaultStrategy</a>  </li><li>| <a href="#v:Filtered">Filtered</a>  </li><li>| <a href="#v:HuffmanOnly">HuffmanOnly</a>  </li></ul></li><li class="src short"><a href="#v:defaultStrategy">defaultStrategy</a> :: <a href="Codec-Compression-Zlib.html#t:CompressionStrategy">CompressionStrategy</a></li><li class="src short"><a href="#v:filteredStrategy">filteredStrategy</a> :: <a href="Codec-Compression-Zlib.html#t:CompressionStrategy">CompressionStrategy</a></li><li class="src short"><a href="#v:huffmanOnlyStrategy">huffmanOnlyStrategy</a> :: <a href="Codec-Compression-Zlib.html#t:CompressionStrategy">CompressionStrategy</a></li></ul></div><div id="interface"><h1>Documentation</h1><div class="doc"><p>This module provides pure functions for compressing and decompressing
 streams of data in the zlib format and represented by lazy <code><a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></code>s.
 This makes it easy to use either in memory or with disk or network IO.
</p></div><h1 id="g:1">Simple compression and decompression
</h1><div class="top"><p class="src"><a name="v:compress" class="def">compress</a> :: <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a><a href="src/Codec-Compression-Zlib.html#compress" class="link">Source</a></p><div class="doc"><p>Compress a stream of data into the zlib format.
</p><p>This uses the default compression parameters. In partiular it uses the
 default compression level which favours a higher compression ratio over
 compression speed, though it does not use the maximum compression level.
</p><p>Use <code><a href="Codec-Compression-Zlib.html#v:compressWith">compressWith</a></code> to adjust the compression level or other compression
 parameters.
</p></div></div><div class="top"><p class="src"><a name="v:decompress" class="def">decompress</a> :: <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a><a href="src/Codec-Compression-Zlib.html#decompress" class="link">Source</a></p><div class="doc"><p>Decompress a stream of data in the zlib format.
</p><p>There are a number of errors that can occur. In each case an exception will
 be thrown. The possible error conditions are:
</p><ul><li> if the stream does not start with a valid gzip header
</li><li> if the compressed stream is corrupted
</li><li> if the compressed stream ends permaturely
</li></ul><p>Note that the decompression is performed <em>lazily</em>. Errors in the data stream
 may not be detected until the end of the stream is demanded (since it is
 only at the end that the final checksum can be checked). If this is
 important to you, you must make sure to consume the whole decompressed
 stream before doing any IO action that depends on it.
</p></div></div><h1 id="g:2">Extended api with control over compression parameters
</h1><div class="top"><p class="src"><a name="v:compressWith" class="def">compressWith</a> :: <a href="Codec-Compression-Zlib.html#t:CompressParams">CompressParams</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a><a href="src/Codec-Compression-Zlib.html#compressWith" class="link">Source</a></p><div class="doc"><p>Like <code><a href="Codec-Compression-Zlib.html#v:compress">compress</a></code> but with the ability to specify various compression
 parameters. Typical usage:
</p><pre> compressWith defaultCompressParams { ... }
</pre><p>In particular you can set the compression level:
</p><pre> compressWith defaultCompressParams { compressLevel = BestCompression }
</pre></div></div><div class="top"><p class="src"><a name="v:decompressWith" class="def">decompressWith</a> :: <a href="Codec-Compression-Zlib.html#t:DecompressParams">DecompressParams</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a><a href="src/Codec-Compression-Zlib.html#decompressWith" class="link">Source</a></p><div class="doc"><p>Like <code><a href="Codec-Compression-Zlib.html#v:decompress">decompress</a></code> but with the ability to specify various decompression
 parameters. Typical usage:
</p><pre> decompressWith defaultCompressParams { ... }
</pre></div></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:CompressParams" class="def">CompressParams</a>  <a href="src/Codec-Compression-Zlib-Internal.html#CompressParams" class="link">Source</a></p><div class="doc"><p>The full set of parameters for compression. The defaults are
 <code><a href="Codec-Compression-Zlib.html#v:defaultCompressParams">defaultCompressParams</a></code>.
</p><p>The <code><a href="Codec-Compression-Zlib.html#v:compressBufferSize">compressBufferSize</a></code> is the size of the first output buffer containing
 the compressed data. If you know an approximate upper bound on the size of
 the compressed data then setting this parameter can save memory. The default
 compression output buffer size is <code>16k</code>. If your extimate is wrong it does
 not matter too much, the default buffer size will be used for the remaining
 chunks.
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:CompressParams" class="def">CompressParams</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><dl><dt class="src"><a name="v:compressLevel" class="def">compressLevel</a> :: !<a href="Codec-Compression-Zlib.html#t:CompressionLevel">CompressionLevel</a></dt><dd class="doc empty">&nbsp;</dd><dt class="src"><a name="v:compressMethod" class="def">compressMethod</a> :: !<a href="Codec-Compression-Zlib.html#t:Method">Method</a></dt><dd class="doc empty">&nbsp;</dd><dt class="src"><a name="v:compressWindowBits" class="def">compressWindowBits</a> :: !<a href="Codec-Compression-Zlib.html#t:WindowBits">WindowBits</a></dt><dd class="doc empty">&nbsp;</dd><dt class="src"><a name="v:compressMemoryLevel" class="def">compressMemoryLevel</a> :: !<a href="Codec-Compression-Zlib.html#t:MemoryLevel">MemoryLevel</a></dt><dd class="doc empty">&nbsp;</dd><dt class="src"><a name="v:compressStrategy" class="def">compressStrategy</a> :: !<a href="Codec-Compression-Zlib.html#t:CompressionStrategy">CompressionStrategy</a></dt><dd class="doc empty">&nbsp;</dd><dt class="src"><a name="v:compressBufferSize" class="def">compressBufferSize</a> :: !<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></dt><dd class="doc empty">&nbsp;</dd></dl><div class="clear"></div></div></td></tr></table></div></div><div class="top"><p class="src"><a name="v:defaultCompressParams" class="def">defaultCompressParams</a> :: <a href="Codec-Compression-Zlib.html#t:CompressParams">CompressParams</a><a href="src/Codec-Compression-Zlib-Internal.html#defaultCompressParams" class="link">Source</a></p><div class="doc"><p>The default set of parameters for compression. This is typically used with
 the <code>compressWith</code> function with specific parameters overridden.
</p></div></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:DecompressParams" class="def">DecompressParams</a>  <a href="src/Codec-Compression-Zlib-Internal.html#DecompressParams" class="link">Source</a></p><div class="doc"><p>The full set of parameters for decompression. The defaults are
 <code><a href="Codec-Compression-Zlib.html#v:defaultDecompressParams">defaultDecompressParams</a></code>.
</p><p>The <code><a href="Codec-Compression-Zlib.html#v:decompressBufferSize">decompressBufferSize</a></code> is the size of the first output buffer,
 containing the uncompressed data. If you know an exact or approximate upper
 bound on the size of the decompressed data then setting this parameter can
 save memory. The default decompression output buffer size is <code>32k</code>. If your
 extimate is wrong it does not matter too much, the default buffer size will
 be used for the remaining chunks.
</p><p>One particular use case for setting the <code><a href="Codec-Compression-Zlib.html#v:decompressBufferSize">decompressBufferSize</a></code> is if you
 know the exact size of the decompressed data and want to produce a strict
 <code>Data.ByteString.ByteString</code>. The compression and deccompression functions
 use lazy <code>Data.ByteString.Lazy.ByteString</code>s but if you set the
 <code><a href="Codec-Compression-Zlib.html#v:decompressBufferSize">decompressBufferSize</a></code> correctly then you can generate a lazy
 <code>Data.ByteString.Lazy.ByteString</code> with exactly one chunk, which can be
 converted to a strict <code>Data.ByteString.ByteString</code> in <code>O(1)</code> time using
 <code><code>Data.ByteString.concat</code> . <code>Data.ByteString.Lazy.toChunks</code></code>.
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:DecompressParams" class="def">DecompressParams</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><dl><dt class="src"><a name="v:decompressWindowBits" class="def">decompressWindowBits</a> :: !<a href="Codec-Compression-Zlib.html#t:WindowBits">WindowBits</a></dt><dd class="doc empty">&nbsp;</dd><dt class="src"><a name="v:decompressBufferSize" class="def">decompressBufferSize</a> :: !<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></dt><dd class="doc empty">&nbsp;</dd></dl><div class="clear"></div></div></td></tr></table></div></div><div class="top"><p class="src"><a name="v:defaultDecompressParams" class="def">defaultDecompressParams</a> :: <a href="Codec-Compression-Zlib.html#t:DecompressParams">DecompressParams</a><a href="src/Codec-Compression-Zlib-Internal.html#defaultDecompressParams" class="link">Source</a></p><div class="doc"><p>The default set of parameters for decompression. This is typically used with
 the <code>compressWith</code> function with specific parameters overridden.
</p></div></div><h2 id="g:3">The compression parameter types
</h2><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:CompressionLevel" class="def">CompressionLevel</a>  <a href="src/Codec-Compression-Zlib-Stream.html#CompressionLevel" class="link">Source</a></p><div class="doc"><p>The compression level parameter controls the amount of compression. This
 is a trade-off between the amount of compression and the time required to do
 the compression.
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:DefaultCompression" class="def">DefaultCompression</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:NoCompression" class="def">NoCompression</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:BestSpeed" class="def">BestSpeed</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:BestCompression" class="def">BestCompression</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:CompressionLevel" class="def">CompressionLevel</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:defaultCompression" class="def">defaultCompression</a> :: <a href="Codec-Compression-Zlib.html#t:CompressionLevel">CompressionLevel</a><a href="src/Codec-Compression-Zlib-Stream.html#defaultCompression" class="link">Source</a></p><div class="doc"><p>The default compression level is 6 (that is, biased towards higher
 compression at expense of speed).
</p></div></div><div class="top"><p class="src"><a name="v:noCompression" class="def">noCompression</a> :: <a href="Codec-Compression-Zlib.html#t:CompressionLevel">CompressionLevel</a><a href="src/Codec-Compression-Zlib-Stream.html#noCompression" class="link">Source</a></p><div class="doc"><p>No compression, just a block copy.
</p></div></div><div class="top"><p class="src"><a name="v:bestSpeed" class="def">bestSpeed</a> :: <a href="Codec-Compression-Zlib.html#t:CompressionLevel">CompressionLevel</a><a href="src/Codec-Compression-Zlib-Stream.html#bestSpeed" class="link">Source</a></p><div class="doc"><p>The fastest compression method (less compression)
</p></div></div><div class="top"><p class="src"><a name="v:bestCompression" class="def">bestCompression</a> :: <a href="Codec-Compression-Zlib.html#t:CompressionLevel">CompressionLevel</a><a href="src/Codec-Compression-Zlib-Stream.html#bestCompression" class="link">Source</a></p><div class="doc"><p>The slowest compression method (best compression).
</p></div></div><div class="top"><p class="src"><a name="v:compressionLevel" class="def">compressionLevel</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-Compression-Zlib.html#t:CompressionLevel">CompressionLevel</a><a href="src/Codec-Compression-Zlib-Stream.html#compressionLevel" class="link">Source</a></p><div class="doc"><p>A specific compression level between 0 and 9.
</p></div></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:Method" class="def">Method</a>  <a href="src/Codec-Compression-Zlib-Stream.html#Method" class="link">Source</a></p><div class="doc"><p>The compression method
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:Deflated" class="def">Deflated</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div><div class="top"><p class="src"><a name="v:deflateMethod" class="def">deflateMethod</a> :: <a href="Codec-Compression-Zlib.html#t:Method">Method</a><a href="src/Codec-Compression-Zlib-Stream.html#deflateMethod" class="link">Source</a></p><div class="doc"><p>'Deflate' is the only method supported in this version of zlib.
 Indeed it is likely to be the only method that ever will be supported.
</p></div></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:WindowBits" class="def">WindowBits</a>  <a href="src/Codec-Compression-Zlib-Stream.html#WindowBits" class="link">Source</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="Codec-Compression-Zlib.html#t:MemoryLevel">MemoryLevel</a></code>. See the <code><a href="Codec-Compression-Zlib.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><tr><td class="src"><a name="v:DefaultWindowBits" class="def">DefaultWindowBits</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-Compression-Zlib.html#t:WindowBits">WindowBits</a><a href="src/Codec-Compression-Zlib-Stream.html#defaultWindowBits" class="link">Source</a></p><div class="doc"><p>The default <code><a href="Codec-Compression-Zlib.html#t:WindowBits">WindowBits</a></code> is 15 which is also the maximum size.
</p></div></div><div class="top"><p 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> -&gt; <a href="Codec-Compression-Zlib.html#t:WindowBits">WindowBits</a><a href="src/Codec-Compression-Zlib-Stream.html#windowBits" class="link">Source</a></p><div class="doc"><p>A specific compression window size, specified in bits in the range <code>8..15</code>
</p></div></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:MemoryLevel" class="def">MemoryLevel</a>  <a href="src/Codec-Compression-Zlib-Stream.html#MemoryLevel" class="link">Source</a></p><div class="doc"><p>The <code><a href="Codec-Compression-Zlib.html#t:MemoryLevel">MemoryLevel</a></code> parameter specifies how much memory should be allocated
 for the internal compression state. It is a tradoff between memory usage,
 compression ratio and compression speed. Using more memory allows faster
 compression and a better compression ratio.
</p><p>The total amount of memory used for compression depends on the <code><a href="Codec-Compression-Zlib.html#t:WindowBits">WindowBits</a></code>
 and the <code><a href="Codec-Compression-Zlib.html#t:MemoryLevel">MemoryLevel</a></code>. For decompression it depends only on the
 <code><a href="Codec-Compression-Zlib.html#t:WindowBits">WindowBits</a></code>. The totals are given by the functions:
</p><pre> compressTotal windowBits memLevel = 4 * 2^windowBits + 512 * 2^memLevel
 decompressTotal windowBits = 2^windowBits
</pre><p>For example, for compression with the default <code>windowBits = 15</code> and
 <code>memLevel = 8</code> uses <code>256Kb</code>. So for example a network server with 100
 concurrent compressed streams would use <code>25Mb</code>. The memory per stream can be
 halved (at the cost of somewhat degraded and slower compressionby) by
 reducing the <code>windowBits</code> and <code>memLevel</code> by one.
</p><p>Decompression takes less memory, the default <code>windowBits = 15</code> corresponds
 to just <code>32Kb</code>.
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:DefaultMemoryLevel" class="def">DefaultMemoryLevel</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:MinMemoryLevel" class="def">MinMemoryLevel</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:MaxMemoryLevel" class="def">MaxMemoryLevel</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:MemoryLevel" class="def">MemoryLevel</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:defaultMemoryLevel" class="def">defaultMemoryLevel</a> :: <a href="Codec-Compression-Zlib.html#t:MemoryLevel">MemoryLevel</a><a href="src/Codec-Compression-Zlib-Stream.html#defaultMemoryLevel" class="link">Source</a></p><div class="doc"><p>The default memory level. (Equivalent to <code><code><a href="Codec-Compression-Zlib.html#v:memoryLevel">memoryLevel</a></code> 8</code>)
</p></div></div><div class="top"><p class="src"><a name="v:minMemoryLevel" class="def">minMemoryLevel</a> :: <a href="Codec-Compression-Zlib.html#t:MemoryLevel">MemoryLevel</a><a href="src/Codec-Compression-Zlib-Stream.html#minMemoryLevel" class="link">Source</a></p><div class="doc"><p>Use minimum memory. This is slow and reduces the compression ratio.
 (Equivalent to <code><code><a href="Codec-Compression-Zlib.html#v:memoryLevel">memoryLevel</a></code> 1</code>)
</p></div></div><div class="top"><p class="src"><a name="v:maxMemoryLevel" class="def">maxMemoryLevel</a> :: <a href="Codec-Compression-Zlib.html#t:MemoryLevel">MemoryLevel</a><a href="src/Codec-Compression-Zlib-Stream.html#maxMemoryLevel" class="link">Source</a></p><div class="doc"><p>Use maximum memory for optimal compression speed.
 (Equivalent to <code><code><a href="Codec-Compression-Zlib.html#v:memoryLevel">memoryLevel</a></code> 9</code>)
</p></div></div><div class="top"><p class="src"><a name="v:memoryLevel" class="def">memoryLevel</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-Compression-Zlib.html#t:MemoryLevel">MemoryLevel</a><a href="src/Codec-Compression-Zlib-Stream.html#memoryLevel" class="link">Source</a></p><div class="doc"><p>A specific level in the range <code>1..9</code>
</p></div></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:CompressionStrategy" class="def">CompressionStrategy</a>  <a href="src/Codec-Compression-Zlib-Stream.html#CompressionStrategy" class="link">Source</a></p><div class="doc"><p>The strategy parameter is used to tune the compression algorithm.
</p><p>The strategy parameter only affects the compression ratio but not the
 correctness of the compressed output even if it is not set appropriately.
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:DefaultStrategy" class="def">DefaultStrategy</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:Filtered" class="def">Filtered</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:HuffmanOnly" class="def">HuffmanOnly</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div><div class="top"><p class="src"><a name="v:defaultStrategy" class="def">defaultStrategy</a> :: <a href="Codec-Compression-Zlib.html#t:CompressionStrategy">CompressionStrategy</a><a href="src/Codec-Compression-Zlib-Stream.html#defaultStrategy" class="link">Source</a></p><div class="doc"><p>Use this default compression strategy for normal data.
</p></div></div><div class="top"><p class="src"><a name="v:filteredStrategy" class="def">filteredStrategy</a> :: <a href="Codec-Compression-Zlib.html#t:CompressionStrategy">CompressionStrategy</a><a href="src/Codec-Compression-Zlib-Stream.html#filteredStrategy" class="link">Source</a></p><div class="doc"><p>Use the filtered compression strategy for data produced by a filter (or
 predictor). Filtered data consists mostly of small values with a somewhat
 random distribution. In this case, the compression algorithm is tuned to
 compress them better. The effect of this strategy is to force more Huffman
 coding and less string matching; it is somewhat intermediate between
 <code>defaultCompressionStrategy</code> and <code>huffmanOnlyCompressionStrategy</code>.
</p></div></div><div class="top"><p class="src"><a name="v:huffmanOnlyStrategy" class="def">huffmanOnlyStrategy</a> :: <a href="Codec-Compression-Zlib.html#t:CompressionStrategy">CompressionStrategy</a><a href="src/Codec-Compression-Zlib-Stream.html#huffmanOnlyStrategy" class="link">Source</a></p><div class="doc"><p>Use the Huffman-only compression strategy to force Huffman encoding only
 (no string match).
</p></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>