Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 77f0c8b2568c8ba86bf4498d38e7ecdc > files > 805

ghc-base-devel-4.2.0.2-8.6.fc14.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--Rendered using the Haskell Html Library v0.2-->
<HTML
><HEAD
><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"
><TITLE
>GHC.IO.Encoding.Types</TITLE
><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"
><SCRIPT SRC="haddock-util.js" TYPE="text/javascript"
></SCRIPT
><SCRIPT TYPE="text/javascript"
>window.onload = function () {setSynopsis("mini_GHC-IO-Encoding-Types.html")};</SCRIPT
></HEAD
><BODY
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="topbar"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD
><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "
></TD
><TD CLASS="title"
>base-4.2.0.2: Basic libraries</TD
><TD CLASS="topbut"
><A HREF="index.html"
>Contents</A
></TD
><TD CLASS="topbut"
><A HREF="doc-index.html"
>Index</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="modulebar"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD
><FONT SIZE="6"
>GHC.IO.Encoding.Types</FONT
></TD
><TD ALIGN="right"
><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="infohead"
>Portability</TD
><TD CLASS="infoval"
>non-portable</TD
></TR
><TR
><TD CLASS="infohead"
>Stability</TD
><TD CLASS="infoval"
>internal</TD
></TR
><TR
><TD CLASS="infohead"
>Maintainer</TD
><TD CLASS="infoval"
>libraries@haskell.org</TD
></TR
></TABLE
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Description</TD
></TR
><TR
><TD CLASS="doc"
>Types for text encoding/decoding
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Synopsis</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>data</SPAN
>  <A HREF="#t%3ABufferCodec"
>BufferCodec</A
> from to state = <A HREF="#v%3ABufferCodec"
>BufferCodec</A
> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="recfield"
><A HREF="#v%3Aencode"
>encode</A
> :: <A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> from -&gt; <A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> to -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> (<A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> from, <A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> to)</TD
></TR
><TR
><TD CLASS="recfield"
><A HREF="#v%3Aclose"
>close</A
> :: <A HREF="System-IO.html#t%3AIO"
>IO</A
> <A HREF="../ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29"
>()</A
></TD
></TR
><TR
><TD CLASS="recfield"
><A HREF="#v%3AgetState"
>getState</A
> :: <A HREF="System-IO.html#t%3AIO"
>IO</A
> state</TD
></TR
><TR
><TD CLASS="recfield"
><A HREF="#v%3AsetState"
>setState</A
> :: state -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> <A HREF="../ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29"
>()</A
></TD
></TR
></TABLE
>}</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>data</SPAN
>  <A HREF="#t%3ATextEncoding"
>TextEncoding</A
>  = <SPAN CLASS="keyword"
>forall</SPAN
> dstate estate . <A HREF="#v%3ATextEncoding"
>TextEncoding</A
> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="recfield"
><A HREF="#v%3AmkTextDecoder"
>mkTextDecoder</A
> :: <A HREF="System-IO.html#t%3AIO"
>IO</A
> (<A HREF="GHC-IO-Encoding-Types.html#t%3ATextDecoder"
>TextDecoder</A
> dstate)</TD
></TR
><TR
><TD CLASS="recfield"
><A HREF="#v%3AmkTextEncoder"
>mkTextEncoder</A
> :: <A HREF="System-IO.html#t%3AIO"
>IO</A
> (<A HREF="GHC-IO-Encoding-Types.html#t%3ATextEncoder"
>TextEncoder</A
> estate)</TD
></TR
></TABLE
>}</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>type</SPAN
> <A HREF="#t%3ATextEncoder"
>TextEncoder</A
> state = <A HREF="GHC-IO-Encoding-Types.html#t%3ABufferCodec"
>BufferCodec</A
> <A HREF="GHC-IO-Buffer.html#t%3ACharBufElem"
>CharBufElem</A
> <A HREF="Data-Word.html#t%3AWord8"
>Word8</A
> state</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>type</SPAN
> <A HREF="#t%3ATextDecoder"
>TextDecoder</A
> state = <A HREF="GHC-IO-Encoding-Types.html#t%3ABufferCodec"
>BufferCodec</A
> <A HREF="Data-Word.html#t%3AWord8"
>Word8</A
> <A HREF="GHC-IO-Buffer.html#t%3ACharBufElem"
>CharBufElem</A
> state</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>type</SPAN
> <A HREF="#t%3AEncodeBuffer"
>EncodeBuffer</A
> = <A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> <A HREF="Data-Char.html#t%3AChar"
>Char</A
> -&gt; <A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> <A HREF="Data-Word.html#t%3AWord8"
>Word8</A
> -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> (<A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> <A HREF="Data-Char.html#t%3AChar"
>Char</A
>, <A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> <A HREF="Data-Word.html#t%3AWord8"
>Word8</A
>)</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>type</SPAN
> <A HREF="#t%3ADecodeBuffer"
>DecodeBuffer</A
> = <A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> <A HREF="Data-Word.html#t%3AWord8"
>Word8</A
> -&gt; <A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> <A HREF="Data-Char.html#t%3AChar"
>Char</A
> -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> (<A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> <A HREF="Data-Word.html#t%3AWord8"
>Word8</A
>, <A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> <A HREF="Data-Char.html#t%3AChar"
>Char</A
>)</TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Documentation</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>data</SPAN
>  <A NAME="t:BufferCodec"
><A NAME="t%3ABufferCodec"
></A
></A
><B
>BufferCodec</B
> from to state </TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="section4"
>Constructors</TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="5" CELLPADDING="0"
><TR
><TD CLASS="arg"
><A NAME="v:BufferCodec"
><A NAME="v%3ABufferCodec"
></A
></A
><B
>BufferCodec</B
></TD
><TD CLASS="rdoc"
></TD
></TR
><TR
><TD CLASS="body" COLSPAN="2"
><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"
><TR
><TD CLASS="arg"
><A NAME="v:encode"
><A NAME="v%3Aencode"
></A
></A
><B
>encode</B
> :: <A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> from -&gt; <A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> to -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> (<A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> from, <A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> to)</TD
><TD CLASS="rdoc"
><P
>The <TT
>encode</TT
> function translates elements of the buffer <TT
>from</TT
>
 to the buffer <TT
>to</TT
>.  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 <TT
>to</TT
>, or <TT
>from</TT
> does not
 contain a complete multibyte sequence.
</P
><P
><TT
>encode</TT
> should raise an exception if, and only if, <TT
>from</TT
>
 begins with an illegal sequence, or the first element of <TT
>from</TT
>
 is not representable in the encoding of <TT
>to</TT
>.  That is, if any
 elements can be successfully translated before an error is
 encountered, then <TT
>encode</TT
> should translate as much as it can
 and not throw an exception.  This behaviour 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
></TD
></TR
><TR
><TD CLASS="arg"
><A NAME="v:close"
><A NAME="v%3Aclose"
></A
></A
><B
>close</B
> :: <A HREF="System-IO.html#t%3AIO"
>IO</A
> <A HREF="../ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29"
>()</A
></TD
><TD CLASS="rdoc"
>Resources associated with the encoding may now be released.
 The <TT
>encode</TT
> function may not be called again after calling
 <TT
>close</TT
>.
</TD
></TR
><TR
><TD CLASS="arg"
><A NAME="v:getState"
><A NAME="v%3AgetState"
></A
></A
><B
>getState</B
> :: <A HREF="System-IO.html#t%3AIO"
>IO</A
> state</TD
><TD CLASS="rdoc"
><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
></TD
></TR
><TR
><TD CLASS="arg"
><A NAME="v:setState"
><A NAME="v%3AsetState"
></A
></A
><B
>setState</B
> :: state -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> <A HREF="../ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29"
>()</A
></TD
><TD CLASS="rdoc"
></TD
></TR
></TABLE
></TD
></TR
></TABLE
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>data</SPAN
>  <A NAME="t:TextEncoding"
><A NAME="t%3ATextEncoding"
></A
></A
><B
>TextEncoding</B
>  </TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="ndoc"
><P
>A <TT
><A HREF="GHC-IO-Encoding-Types.html#t%3ATextEncoding"
>TextEncoding</A
></TT
> 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 <TT
><A HREF="GHC-IO-Encoding-Types.html#t%3ATextEncoding"
>TextEncoding</A
></TT
> for UTF-8 is utf8.
</P
></TD
></TR
><TR
><TD CLASS="section4"
>Constructors</TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="5" CELLPADDING="0"
><TR
><TD CLASS="arg"
><SPAN CLASS="keyword"
>forall</SPAN
> dstate estate . <A NAME="v:TextEncoding"
><A NAME="v%3ATextEncoding"
></A
></A
><B
>TextEncoding</B
></TD
><TD CLASS="rdoc"
></TD
></TR
><TR
><TD CLASS="body" COLSPAN="2"
><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"
><TR
><TD CLASS="arg"
><A NAME="v:mkTextDecoder"
><A NAME="v%3AmkTextDecoder"
></A
></A
><B
>mkTextDecoder</B
> :: <A HREF="System-IO.html#t%3AIO"
>IO</A
> (<A HREF="GHC-IO-Encoding-Types.html#t%3ATextDecoder"
>TextDecoder</A
> dstate)</TD
><TD CLASS="rdoc"
></TD
></TR
><TR
><TD CLASS="arg"
><A NAME="v:mkTextEncoder"
><A NAME="v%3AmkTextEncoder"
></A
></A
><B
>mkTextEncoder</B
> :: <A HREF="System-IO.html#t%3AIO"
>IO</A
> (<A HREF="GHC-IO-Encoding-Types.html#t%3ATextEncoder"
>TextEncoder</A
> estate)</TD
><TD CLASS="rdoc"
></TD
></TR
></TABLE
></TD
></TR
></TABLE
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>type</SPAN
> <A NAME="t:TextEncoder"
><A NAME="t%3ATextEncoder"
></A
></A
><B
>TextEncoder</B
> state = <A HREF="GHC-IO-Encoding-Types.html#t%3ABufferCodec"
>BufferCodec</A
> <A HREF="GHC-IO-Buffer.html#t%3ACharBufElem"
>CharBufElem</A
> <A HREF="Data-Word.html#t%3AWord8"
>Word8</A
> state</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>type</SPAN
> <A NAME="t:TextDecoder"
><A NAME="t%3ATextDecoder"
></A
></A
><B
>TextDecoder</B
> state = <A HREF="GHC-IO-Encoding-Types.html#t%3ABufferCodec"
>BufferCodec</A
> <A HREF="Data-Word.html#t%3AWord8"
>Word8</A
> <A HREF="GHC-IO-Buffer.html#t%3ACharBufElem"
>CharBufElem</A
> state</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>type</SPAN
> <A NAME="t:EncodeBuffer"
><A NAME="t%3AEncodeBuffer"
></A
></A
><B
>EncodeBuffer</B
> = <A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> <A HREF="Data-Char.html#t%3AChar"
>Char</A
> -&gt; <A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> <A HREF="Data-Word.html#t%3AWord8"
>Word8</A
> -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> (<A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> <A HREF="Data-Char.html#t%3AChar"
>Char</A
>, <A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> <A HREF="Data-Word.html#t%3AWord8"
>Word8</A
>)</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>type</SPAN
> <A NAME="t:DecodeBuffer"
><A NAME="t%3ADecodeBuffer"
></A
></A
><B
>DecodeBuffer</B
> = <A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> <A HREF="Data-Word.html#t%3AWord8"
>Word8</A
> -&gt; <A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> <A HREF="Data-Char.html#t%3AChar"
>Char</A
> -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> (<A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> <A HREF="Data-Word.html#t%3AWord8"
>Word8</A
>, <A HREF="GHC-IO-Buffer.html#t%3ABuffer"
>Buffer</A
> <A HREF="Data-Char.html#t%3AChar"
>Char</A
>)</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="botbar"
>Produced by <A HREF="http://www.haskell.org/haddock/"
>Haddock</A
> version 2.6.1</TD
></TR
></TABLE
></BODY
></HTML
>