Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > eb72428f357936ee1af1fef56155f371 > files > 89

ghc-text-devel-0.10.0.0-1.fc14.i686.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
>Data.Text.Lazy.Read</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_Data-Text-Lazy-Read.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"
>text-0.10.0.0: An efficient packed Unicode text type.</TD
><TD CLASS="topbut"
><A HREF="src/Data-Text-Lazy-Read.html"
>Source code</A
></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"
>Data.Text.Lazy.Read</FONT
></TD
><TD ALIGN="right"
><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="infohead"
>Portability</TD
><TD CLASS="infoval"
>GHC</TD
></TR
><TR
><TD CLASS="infohead"
>Stability</TD
><TD CLASS="infoval"
>experimental</TD
></TR
><TR
><TD CLASS="infohead"
>Maintainer</TD
><TD CLASS="infoval"
>bos@serpentine.com, rtomharper@googlemail.com,
               duncan@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"
>Functions used frequently when reading textual data.
</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"
>type</SPAN
> <A HREF="#t%3AReader"
>Reader</A
> a = <A HREF="Data-Text-Lazy.html#t%3AText"
>Text</A
> -&gt; <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Either.html#t%3AEither"
>Either</A
> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString"
>String</A
> (a, <A HREF="Data-Text-Lazy.html#t%3AText"
>Text</A
>)</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Adecimal"
>decimal</A
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AIntegral"
>Integral</A
> a =&gt; <A HREF="Data-Text-Lazy-Read.html#t%3AReader"
>Reader</A
> a</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Ahexadecimal"
>hexadecimal</A
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AIntegral"
>Integral</A
> a =&gt; <A HREF="Data-Text-Lazy-Read.html#t%3AReader"
>Reader</A
> a</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Asigned"
>signed</A
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ANum"
>Num</A
> a =&gt; <A HREF="Data-Text-Lazy-Read.html#t%3AReader"
>Reader</A
> a -&gt; <A HREF="Data-Text-Lazy-Read.html#t%3AReader"
>Reader</A
> a</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Arational"
>rational</A
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ARealFloat"
>RealFloat</A
> a =&gt; <A HREF="Data-Text-Lazy-Read.html#t%3AReader"
>Reader</A
> a</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Adouble"
>double</A
> :: <A HREF="Data-Text-Lazy-Read.html#t%3AReader"
>Reader</A
> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ADouble"
>Double</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="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><SPAN CLASS="keyword"
>type</SPAN
> <A NAME="t:Reader"
><A NAME="t%3AReader"
></A
></A
><B
>Reader</B
> a = <A HREF="Data-Text-Lazy.html#t%3AText"
>Text</A
> -&gt; <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Either.html#t%3AEither"
>Either</A
> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString"
>String</A
> (a, <A HREF="Data-Text-Lazy.html#t%3AText"
>Text</A
>)</TD
><TD CLASS="declbut"
><A HREF="src/Data-Text-Lazy-Read.html#Reader"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="doc"
>Read some text.  If the read succeeds, return its value and the
 remaining text, otherwise an error message.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><A NAME="v:decimal"
><A NAME="v%3Adecimal"
></A
></A
><B
>decimal</B
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AIntegral"
>Integral</A
> a =&gt; <A HREF="Data-Text-Lazy-Read.html#t%3AReader"
>Reader</A
> a</TD
><TD CLASS="declbut"
><A HREF="src/Data-Text-Lazy-Read.html#decimal"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="doc"
><P
>Read a decimal integer.  The input must begin with at least one
 decimal digit, and is consumed until a non-digit or end of string
 is reached.
</P
><P
>This function does not handle leading sign characters.  If you need
 to handle signed input, use <TT
><TT
><A HREF="Data-Text-Lazy-Read.html#v%3Asigned"
>signed</A
></TT
> <TT
><A HREF="Data-Text-Lazy-Read.html#v%3Adecimal"
>decimal</A
></TT
></TT
>.
</P
><P
><EM
>Note</EM
>: For fixed-width integer types, this function does not
 attempt to detect overflow, so a sufficiently long input may give
 incorrect results.
</P
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><A NAME="v:hexadecimal"
><A NAME="v%3Ahexadecimal"
></A
></A
><B
>hexadecimal</B
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AIntegral"
>Integral</A
> a =&gt; <A HREF="Data-Text-Lazy-Read.html#t%3AReader"
>Reader</A
> a</TD
><TD CLASS="declbut"
><A HREF="src/Data-Text-Lazy-Read.html#hexadecimal"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="doc"
><P
>Read a hexadecimal integer, consisting of an optional leading
 <TT
>&quot;0x&quot;</TT
> followed by at least one decimal digit. Input is consumed
 until a non-hex-digit or end of string is reached.  This function
 is case insensitive.
</P
><P
>This function does not handle leading sign characters.  If you need
 to handle signed input, use <TT
><TT
><A HREF="Data-Text-Lazy-Read.html#v%3Asigned"
>signed</A
></TT
> <TT
><A HREF="Data-Text-Lazy-Read.html#v%3Ahexadecimal"
>hexadecimal</A
></TT
></TT
>.
</P
><P
><EM
>Note</EM
>: For fixed-width integer types, this function does not
 attempt to detect overflow, so a sufficiently long input may give
 incorrect results.
</P
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><A NAME="v:signed"
><A NAME="v%3Asigned"
></A
></A
><B
>signed</B
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ANum"
>Num</A
> a =&gt; <A HREF="Data-Text-Lazy-Read.html#t%3AReader"
>Reader</A
> a -&gt; <A HREF="Data-Text-Lazy-Read.html#t%3AReader"
>Reader</A
> a</TD
><TD CLASS="declbut"
><A HREF="src/Data-Text-Lazy-Read.html#signed"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="doc"
>Read an optional leading sign character (<TT
>'-'</TT
> or <TT
>'+'</TT
>) and
 apply it to the result of applying the given reader.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><A NAME="v:rational"
><A NAME="v%3Arational"
></A
></A
><B
>rational</B
> :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ARealFloat"
>RealFloat</A
> a =&gt; <A HREF="Data-Text-Lazy-Read.html#t%3AReader"
>Reader</A
> a</TD
><TD CLASS="declbut"
><A HREF="src/Data-Text-Lazy-Read.html#rational"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="doc"
><P
>Read a rational number.
</P
><P
>This function accepts an optional leading sign character, followed
 by at least one decimal digit.  The syntax similar to that accepted
 by the <TT
><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Text-Read.html#v%3Aread"
>read</A
></TT
> function, with the exception that a trailing <TT
>'.'</TT
>
 or <TT
>'e'</TT
> <EM
>not</EM
> followed by a number is not consumed.
</P
><P
>Examples:
</P
><PRE
>rational &quot;3&quot;     == Right (3.0, &quot;&quot;)
rational &quot;3.1&quot;   == Right (3.1, &quot;&quot;)
rational &quot;3e4&quot;   == Right (30000.0, &quot;&quot;)
rational &quot;3.1e4&quot; == Right (31000.0, &quot;&quot;)
rational &quot;.3&quot;    == Left &quot;input does not start with a digit&quot;
rational &quot;e3&quot;    == Left &quot;input does not start with a digit&quot;
</PRE
><P
>Examples of differences from <TT
><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Text-Read.html#v%3Aread"
>read</A
></TT
>:
</P
><PRE
>rational &quot;3.foo&quot; == Right (3.0, &quot;.foo&quot;)
rational &quot;3e&quot;    == Right (3.0, &quot;e&quot;)
</PRE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="topdecl"
><TABLE CLASS="declbar"
><TR
><TD CLASS="declname"
><A NAME="v:double"
><A NAME="v%3Adouble"
></A
></A
><B
>double</B
> :: <A HREF="Data-Text-Lazy-Read.html#t%3AReader"
>Reader</A
> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ADouble"
>Double</A
></TD
><TD CLASS="declbut"
><A HREF="src/Data-Text-Lazy-Read.html#double"
>Source</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="doc"
><P
>Read a rational number.
</P
><P
>The syntax accepted by this function is the same as for <TT
><A HREF="Data-Text-Lazy-Read.html#v%3Arational"
>rational</A
></TT
>.
</P
><P
><EM
>Note</EM
>: This function is almost ten times faster than <TT
><A HREF="Data-Text-Lazy-Read.html#v%3Arational"
>rational</A
></TT
>,
 but is slightly less accurate.
</P
><P
>The <TT
><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3ADouble"
>Double</A
></TT
> type supports about 16 decimal places of accuracy.
 For 94.2% of numbers, this function and <TT
><A HREF="Data-Text-Lazy-Read.html#v%3Arational"
>rational</A
></TT
> give identical
 results, but for the remaining 5.8%, this function loses precision
 around the 15th decimal place.  For 0.001% of numbers, this
 function will lose precision at the 13th or 14th decimal place.
</P
></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
>