Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-release > by-pkgid > 6e204a966e8c42d976f99a1700ce5f20 > files > 2308

ghc-7.4.2-4.mga5.i586.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>GHC.IO.Encoding.Types</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_GHC-IO-Encoding-Types.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">base-4.5.1.0: Basic libraries</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>non-portable</td></tr><tr><th>Stability</th><td>internal</td></tr><tr><th>Maintainer</th><td>libraries@haskell.org</td></tr><tr><th>Safe Haskell</th><td>Trustworthy</td></tr></table><p class="caption">GHC.IO.Encoding.Types</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Types for text encoding/decoding
</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:BufferCodec">BufferCodec</a> from to state = <a href="#v:BufferCodec">BufferCodec</a> {<ul class="subs"><li><a href="#v:encode">encode</a> :: <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> from -&gt; <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> to -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Encoding-Types.html#t:CodingProgress">CodingProgress</a>, <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> from, <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> to)</li><li><a href="#v:recover">recover</a> :: <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> from -&gt; <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> to -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> from, <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> to)</li><li><a href="#v:close">close</a> :: <a href="System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li><a href="#v:getState">getState</a> :: <a href="System-IO.html#t:IO">IO</a> state</li><li><a href="#v:setState">setState</a> :: state -&gt; <a href="System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li></ul>}</li><li class="src short"><span class="keyword">data</span>  <a href="#t:TextEncoding">TextEncoding</a>  = <span class="keyword">forall</span> dstate estate . <a href="#v:TextEncoding">TextEncoding</a> {<ul class="subs"><li><a href="#v:textEncodingName">textEncodingName</a> :: <a href="Data-String.html#t:String">String</a></li><li><a href="#v:mkTextDecoder">mkTextDecoder</a> :: <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Encoding-Types.html#t:TextDecoder">TextDecoder</a> dstate)</li><li><a href="#v:mkTextEncoder">mkTextEncoder</a> :: <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Encoding-Types.html#t:TextEncoder">TextEncoder</a> estate)</li></ul>}</li><li class="src short"><span class="keyword">type</span> <a href="#t:TextEncoder">TextEncoder</a> state = <a href="GHC-IO-Encoding-Types.html#t:BufferCodec">BufferCodec</a> <a href="GHC-IO-Buffer.html#t:CharBufElem">CharBufElem</a> <a href="Data-Word.html#t:Word8">Word8</a> state</li><li class="src short"><span class="keyword">type</span> <a href="#t:TextDecoder">TextDecoder</a> state = <a href="GHC-IO-Encoding-Types.html#t:BufferCodec">BufferCodec</a> <a href="Data-Word.html#t:Word8">Word8</a> <a href="GHC-IO-Buffer.html#t:CharBufElem">CharBufElem</a> state</li><li class="src short"><span class="keyword">type</span> <a href="#t:EncodeBuffer">EncodeBuffer</a> = <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Char.html#t:Char">Char</a> -&gt; <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Word.html#t:Word8">Word8</a> -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Encoding-Types.html#t:CodingProgress">CodingProgress</a>, <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Char.html#t:Char">Char</a>, <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Word.html#t:Word8">Word8</a>)</li><li class="src short"><span class="keyword">type</span> <a href="#t:DecodeBuffer">DecodeBuffer</a> = <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Word.html#t:Word8">Word8</a> -&gt; <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Char.html#t:Char">Char</a> -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Encoding-Types.html#t:CodingProgress">CodingProgress</a>, <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Word.html#t:Word8">Word8</a>, <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Char.html#t:Char">Char</a>)</li><li class="src short"><span class="keyword">data</span>  <a href="#t:CodingProgress">CodingProgress</a> <ul class="subs"><li>= <a href="#v:InputUnderflow">InputUnderflow</a>  </li><li>| <a href="#v:OutputUnderflow">OutputUnderflow</a>  </li><li>| <a href="#v:InvalidSequence">InvalidSequence</a>  </li></ul></li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:BufferCodec" class="def">BufferCodec</a> from to state </p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:BufferCodec" class="def">BufferCodec</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:encode" class="def">encode</a> :: <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> from -&gt; <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> to -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Encoding-Types.html#t:CodingProgress">CodingProgress</a>, <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> from, <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> to)</dt><dd class="doc"><p>The <code>encode</code> function translates elements of the buffer <code>from</code>
 to the buffer <code>to</code>.  It should translate as many elements as possible
 given the sizes of the buffers, including translating zero elements
 if there is either not enough room in <code>to</code>, or <code>from</code> does not
 contain a complete multibyte sequence.
</p><p>The fact that as many elements as possible are translated is used by the IO
 library in order to report translation errors at the point they
 actually occur, rather than when the buffer is translated.
</p><p>To allow us to use iconv as a BufferCode efficiently, character buffers are
 defined to contain lone surrogates instead of those private use characters that
 are used for roundtripping. Thus, Chars poked and peeked from a character buffer
 must undergo surrogatifyRoundtripCharacter and desurrogatifyRoundtripCharacter
 respectively.
</p><p>For more information on this, see Note [Roundtripping] in GHC.IO.Encoding.Failure.
</p></dd><dt class="src"><a name="v:recover" class="def">recover</a> :: <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> from -&gt; <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> to -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> from, <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> to)</dt><dd class="doc"><p>The <code>recover</code> function is used to continue decoding
 in the presence of invalid or unrepresentable sequences. This includes
 both those detected by <code>encode</code> returning <code>InvalidSequence</code> and those
 that occur because the input byte sequence appears to be truncated.
</p><p>Progress will usually be made by skipping the first element of the <code>from</code>
 buffer. This function should only be called if you are certain that you
 wish to do this skipping and if the <code>to</code> buffer has at least one element
 of free space. Because this function deals with decoding failure, it assumes
 that the from buffer has at least one element.
</p><p><code>recover</code> may raise an exception rather than skipping anything.
</p><p>Currently, some implementations of <code>recover</code> may mutate the input buffer.
 In particular, this feature is used to implement transliteration.
</p></dd><dt class="src"><a name="v:close" class="def">close</a> :: <a href="System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></dt><dd class="doc"><p>Resources associated with the encoding may now be released.
 The <code>encode</code> function may not be called again after calling
 <code>close</code>.
</p></dd><dt class="src"><a name="v:getState" class="def">getState</a> :: <a href="System-IO.html#t:IO">IO</a> state</dt><dd class="doc"><p>Return the current state of the codec.
</p><p>Many codecs are not stateful, and in these case the state can be
 represented as '()'.  Other codecs maintain a state.  For
 example, UTF-16 recognises a BOM (byte-order-mark) character at
 the beginning of the input, and remembers thereafter whether to
 use big-endian or little-endian mode.  In this case, the state
 of the codec would include two pieces of information: whether we
 are at the beginning of the stream (the BOM only occurs at the
 beginning), and if not, whether to use the big or little-endian
 encoding.
</p></dd><dt class="src"><a name="v:setState" class="def">setState</a> :: state -&gt; <a href="System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</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"><span class="keyword">data</span>  <a name="t:TextEncoding" class="def">TextEncoding</a>  </p><div class="doc"><p>A <code><a href="GHC-IO-Encoding-Types.html#t:TextEncoding">TextEncoding</a></code> is a specification of a conversion scheme
 between sequences of bytes and sequences of Unicode characters.
</p><p>For example, UTF-8 is an encoding of Unicode characters into a sequence
 of bytes.  The <code><a href="GHC-IO-Encoding-Types.html#t:TextEncoding">TextEncoding</a></code> for UTF-8 is <code>utf8</code>.
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><span class="keyword">forall</span> dstate estate . <a name="v:TextEncoding" class="def">TextEncoding</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:textEncodingName" class="def">textEncodingName</a> :: <a href="Data-String.html#t:String">String</a></dt><dd class="doc"><p>a string that can be passed to <code>mkTextEncoding</code> to
 create an equivalent <code><a href="GHC-IO-Encoding-Types.html#t:TextEncoding">TextEncoding</a></code>.
</p></dd><dt class="src"><a name="v:mkTextDecoder" class="def">mkTextDecoder</a> :: <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Encoding-Types.html#t:TextDecoder">TextDecoder</a> dstate)</dt><dd class="doc"><p>Creates a means of decoding bytes into characters: the result must not
 be shared between several byte sequences or simultaneously across threads
</p></dd><dt class="src"><a name="v:mkTextEncoder" class="def">mkTextEncoder</a> :: <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Encoding-Types.html#t:TextEncoder">TextEncoder</a> estate)</dt><dd class="doc"><p>Creates a means of encode characters into bytes: the result must not
 be shared between several character sequences or simultaneously across threads
</p></dd></dl><div class="clear"></div></div></td></tr></table></div><div class="subs instances"><p id="control.i:TextEncoding" class="caption collapser" onclick="toggleSection('i:TextEncoding')">Instances</p><div id="section.i:TextEncoding" class="show"><table><tr><td class="src"><a href="Text-Show.html#t:Show">Show</a> <a href="GHC-IO-Encoding-Types.html#t:TextEncoding">TextEncoding</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:TextEncoder" class="def">TextEncoder</a> state = <a href="GHC-IO-Encoding-Types.html#t:BufferCodec">BufferCodec</a> <a href="GHC-IO-Buffer.html#t:CharBufElem">CharBufElem</a> <a href="Data-Word.html#t:Word8">Word8</a> state</p></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:TextDecoder" class="def">TextDecoder</a> state = <a href="GHC-IO-Encoding-Types.html#t:BufferCodec">BufferCodec</a> <a href="Data-Word.html#t:Word8">Word8</a> <a href="GHC-IO-Buffer.html#t:CharBufElem">CharBufElem</a> state</p></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:EncodeBuffer" class="def">EncodeBuffer</a> = <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Char.html#t:Char">Char</a> -&gt; <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Word.html#t:Word8">Word8</a> -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Encoding-Types.html#t:CodingProgress">CodingProgress</a>, <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Char.html#t:Char">Char</a>, <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Word.html#t:Word8">Word8</a>)</p></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:DecodeBuffer" class="def">DecodeBuffer</a> = <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Word.html#t:Word8">Word8</a> -&gt; <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Char.html#t:Char">Char</a> -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Encoding-Types.html#t:CodingProgress">CodingProgress</a>, <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Word.html#t:Word8">Word8</a>, <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Char.html#t:Char">Char</a>)</p></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:CodingProgress" class="def">CodingProgress</a>  </p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:InputUnderflow" class="def">InputUnderflow</a></td><td class="doc"><p>Stopped because the input contains insufficient available elements,
 or all of the input sequence has been sucessfully translated.
</p></td></tr><tr><td class="src"><a name="v:OutputUnderflow" class="def">OutputUnderflow</a></td><td class="doc"><p>Stopped because the output contains insufficient free elements
</p></td></tr><tr><td class="src"><a name="v:InvalidSequence" class="def">InvalidSequence</a></td><td class="doc"><p>Stopped because there are sufficient free elements in the output
 to output at least one encoded ASCII character, but the input contains
 an invalid or unrepresentable sequence
</p></td></tr></table></div><div class="subs instances"><p id="control.i:CodingProgress" class="caption collapser" onclick="toggleSection('i:CodingProgress')">Instances</p><div id="section.i:CodingProgress" class="show"><table><tr><td class="src"><a href="Data-Eq.html#t:Eq">Eq</a> <a href="GHC-IO-Encoding-Types.html#t:CodingProgress">CodingProgress</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Text-Show.html#t:Show">Show</a> <a href="GHC-IO-Encoding-Types.html#t:CodingProgress">CodingProgress</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.11.0</p></div></body></html>