Sophie

Sophie

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

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>Numeric</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_Numeric.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>portable</td></tr><tr><th>Stability</th><td>provisional</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">Numeric</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Showing
</a></li><li><a href="#g:2">Reading
</a></li><li><a href="#g:3">Miscellaneous
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Odds and ends, mostly functions for reading and showing
 <code><a href="Prelude.html#t:RealFloat">RealFloat</a></code>-like kind of values.
</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:showSigned">showSigned</a> :: <a href="Prelude.html#t:Real">Real</a> a =&gt; (a -&gt; <a href="Text-Show.html#t:ShowS">ShowS</a>) -&gt; <a href="Data-Int.html#t:Int">Int</a> -&gt; a -&gt; <a href="Text-Show.html#t:ShowS">ShowS</a></li><li class="src short"><a href="#v:showIntAtBase">showIntAtBase</a> :: (<a href="Prelude.html#t:Integral">Integral</a> a, <a href="Text-Show.html#t:Show">Show</a> a) =&gt; a -&gt; (<a href="Data-Int.html#t:Int">Int</a> -&gt; <a href="Data-Char.html#t:Char">Char</a>) -&gt; a -&gt; <a href="Text-Show.html#t:ShowS">ShowS</a></li><li class="src short"><a href="#v:showInt">showInt</a> :: <a href="Prelude.html#t:Integral">Integral</a> a =&gt; a -&gt; <a href="Text-Show.html#t:ShowS">ShowS</a></li><li class="src short"><a href="#v:showHex">showHex</a> :: (<a href="Prelude.html#t:Integral">Integral</a> a, <a href="Text-Show.html#t:Show">Show</a> a) =&gt; a -&gt; <a href="Text-Show.html#t:ShowS">ShowS</a></li><li class="src short"><a href="#v:showOct">showOct</a> :: (<a href="Prelude.html#t:Integral">Integral</a> a, <a href="Text-Show.html#t:Show">Show</a> a) =&gt; a -&gt; <a href="Text-Show.html#t:ShowS">ShowS</a></li><li class="src short"><a href="#v:showEFloat">showEFloat</a> :: <a href="Prelude.html#t:RealFloat">RealFloat</a> a =&gt; <a href="Data-Maybe.html#t:Maybe">Maybe</a> <a href="Data-Int.html#t:Int">Int</a> -&gt; a -&gt; <a href="Text-Show.html#t:ShowS">ShowS</a></li><li class="src short"><a href="#v:showFFloat">showFFloat</a> :: <a href="Prelude.html#t:RealFloat">RealFloat</a> a =&gt; <a href="Data-Maybe.html#t:Maybe">Maybe</a> <a href="Data-Int.html#t:Int">Int</a> -&gt; a -&gt; <a href="Text-Show.html#t:ShowS">ShowS</a></li><li class="src short"><a href="#v:showGFloat">showGFloat</a> :: <a href="Prelude.html#t:RealFloat">RealFloat</a> a =&gt; <a href="Data-Maybe.html#t:Maybe">Maybe</a> <a href="Data-Int.html#t:Int">Int</a> -&gt; a -&gt; <a href="Text-Show.html#t:ShowS">ShowS</a></li><li class="src short"><a href="#v:showFloat">showFloat</a> :: <a href="Prelude.html#t:RealFloat">RealFloat</a> a =&gt; a -&gt; <a href="Text-Show.html#t:ShowS">ShowS</a></li><li class="src short"><a href="#v:floatToDigits">floatToDigits</a> :: <a href="Prelude.html#t:RealFloat">RealFloat</a> a =&gt; <a href="Prelude.html#t:Integer">Integer</a> -&gt; a -&gt; ([<a href="Data-Int.html#t:Int">Int</a>], <a href="Data-Int.html#t:Int">Int</a>)</li><li class="src short"><a href="#v:readSigned">readSigned</a> :: <a href="Prelude.html#t:Real">Real</a> a =&gt; <a href="Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> a -&gt; <a href="Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> a</li><li class="src short"><a href="#v:readInt">readInt</a> :: <a href="Prelude.html#t:Num">Num</a> a =&gt; a -&gt; (<a href="Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Bool.html#t:Bool">Bool</a>) -&gt; (<a href="Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Int.html#t:Int">Int</a>) -&gt; <a href="Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> a</li><li class="src short"><a href="#v:readDec">readDec</a> :: (<a href="Data-Eq.html#t:Eq">Eq</a> a, <a href="Prelude.html#t:Num">Num</a> a) =&gt; <a href="Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> a</li><li class="src short"><a href="#v:readOct">readOct</a> :: (<a href="Data-Eq.html#t:Eq">Eq</a> a, <a href="Prelude.html#t:Num">Num</a> a) =&gt; <a href="Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> a</li><li class="src short"><a href="#v:readHex">readHex</a> :: (<a href="Data-Eq.html#t:Eq">Eq</a> a, <a href="Prelude.html#t:Num">Num</a> a) =&gt; <a href="Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> a</li><li class="src short"><a href="#v:readFloat">readFloat</a> :: <a href="Prelude.html#t:RealFrac">RealFrac</a> a =&gt; <a href="Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> a</li><li class="src short"><a href="#v:lexDigits">lexDigits</a> :: <a href="Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> <a href="Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:fromRat">fromRat</a> :: <a href="Prelude.html#t:RealFloat">RealFloat</a> a =&gt; <a href="Prelude.html#t:Rational">Rational</a> -&gt; a</li></ul></div><div id="interface"><h1 id="g:1">Showing
</h1><div class="top"><p class="src"><a name="v:showSigned" class="def">showSigned</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Prelude.html#t:Real">Real</a> a</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">=&gt; (a -&gt; <a href="Text-Show.html#t:ShowS">ShowS</a>)</td><td class="doc"><p>a function that can show unsigned values
</p></td></tr><tr><td class="src">-&gt; <a href="Data-Int.html#t:Int">Int</a></td><td class="doc"><p>the precedence of the enclosing context
</p></td></tr><tr><td class="src">-&gt; a</td><td class="doc"><p>the value to show
</p></td></tr><tr><td class="src">-&gt; <a href="Text-Show.html#t:ShowS">ShowS</a></td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p>Converts a possibly-negative <code><a href="Prelude.html#t:Real">Real</a></code> value to a string.
</p></div></div><div class="top"><p class="src"><a name="v:showIntAtBase" class="def">showIntAtBase</a> :: (<a href="Prelude.html#t:Integral">Integral</a> a, <a href="Text-Show.html#t:Show">Show</a> a) =&gt; a -&gt; (<a href="Data-Int.html#t:Int">Int</a> -&gt; <a href="Data-Char.html#t:Char">Char</a>) -&gt; a -&gt; <a href="Text-Show.html#t:ShowS">ShowS</a></p><div class="doc"><p>Shows a <em>non-negative</em> <code><a href="Prelude.html#t:Integral">Integral</a></code> number using the base specified by the
 first argument, and the character representation specified by the second.
</p></div></div><div class="top"><p class="src"><a name="v:showInt" class="def">showInt</a> :: <a href="Prelude.html#t:Integral">Integral</a> a =&gt; a -&gt; <a href="Text-Show.html#t:ShowS">ShowS</a></p><div class="doc"><p>Show <em>non-negative</em> <code><a href="Prelude.html#t:Integral">Integral</a></code> numbers in base 10.
</p></div></div><div class="top"><p class="src"><a name="v:showHex" class="def">showHex</a> :: (<a href="Prelude.html#t:Integral">Integral</a> a, <a href="Text-Show.html#t:Show">Show</a> a) =&gt; a -&gt; <a href="Text-Show.html#t:ShowS">ShowS</a></p><div class="doc"><p>Show <em>non-negative</em> <code><a href="Prelude.html#t:Integral">Integral</a></code> numbers in base 16.
</p></div></div><div class="top"><p class="src"><a name="v:showOct" class="def">showOct</a> :: (<a href="Prelude.html#t:Integral">Integral</a> a, <a href="Text-Show.html#t:Show">Show</a> a) =&gt; a -&gt; <a href="Text-Show.html#t:ShowS">ShowS</a></p><div class="doc"><p>Show <em>non-negative</em> <code><a href="Prelude.html#t:Integral">Integral</a></code> numbers in base 8.
</p></div></div><div class="top"><p class="src"><a name="v:showEFloat" class="def">showEFloat</a> :: <a href="Prelude.html#t:RealFloat">RealFloat</a> a =&gt; <a href="Data-Maybe.html#t:Maybe">Maybe</a> <a href="Data-Int.html#t:Int">Int</a> -&gt; a -&gt; <a href="Text-Show.html#t:ShowS">ShowS</a></p><div class="doc"><p>Show a signed <code><a href="Prelude.html#t:RealFloat">RealFloat</a></code> value
 using scientific (exponential) notation (e.g. <code>2.45e2</code>, <code>1.5e-3</code>).
</p><p>In the call <code><code><a href="Numeric.html#v:showEFloat">showEFloat</a></code> digs val</code>, if <code>digs</code> is <code><a href="Data-Maybe.html#v:Nothing">Nothing</a></code>,
 the value is shown to full precision; if <code>digs</code> is <code><code><a href="Data-Maybe.html#v:Just">Just</a></code> d</code>,
 then at most <code>d</code> digits after the decimal point are shown.
</p></div></div><div class="top"><p class="src"><a name="v:showFFloat" class="def">showFFloat</a> :: <a href="Prelude.html#t:RealFloat">RealFloat</a> a =&gt; <a href="Data-Maybe.html#t:Maybe">Maybe</a> <a href="Data-Int.html#t:Int">Int</a> -&gt; a -&gt; <a href="Text-Show.html#t:ShowS">ShowS</a></p><div class="doc"><p>Show a signed <code><a href="Prelude.html#t:RealFloat">RealFloat</a></code> value
 using standard decimal notation (e.g. <code>245000</code>, <code>0.0015</code>).
</p><p>In the call <code><code><a href="Numeric.html#v:showFFloat">showFFloat</a></code> digs val</code>, if <code>digs</code> is <code><a href="Data-Maybe.html#v:Nothing">Nothing</a></code>,
 the value is shown to full precision; if <code>digs</code> is <code><code><a href="Data-Maybe.html#v:Just">Just</a></code> d</code>,
 then at most <code>d</code> digits after the decimal point are shown.
</p></div></div><div class="top"><p class="src"><a name="v:showGFloat" class="def">showGFloat</a> :: <a href="Prelude.html#t:RealFloat">RealFloat</a> a =&gt; <a href="Data-Maybe.html#t:Maybe">Maybe</a> <a href="Data-Int.html#t:Int">Int</a> -&gt; a -&gt; <a href="Text-Show.html#t:ShowS">ShowS</a></p><div class="doc"><p>Show a signed <code><a href="Prelude.html#t:RealFloat">RealFloat</a></code> value
 using standard decimal notation for arguments whose absolute value lies 
 between <code>0.1</code> and <code>9,999,999</code>, and scientific notation otherwise.
</p><p>In the call <code><code><a href="Numeric.html#v:showGFloat">showGFloat</a></code> digs val</code>, if <code>digs</code> is <code><a href="Data-Maybe.html#v:Nothing">Nothing</a></code>,
 the value is shown to full precision; if <code>digs</code> is <code><code><a href="Data-Maybe.html#v:Just">Just</a></code> d</code>,
 then at most <code>d</code> digits after the decimal point are shown.
</p></div></div><div class="top"><p class="src"><a name="v:showFloat" class="def">showFloat</a> :: <a href="Prelude.html#t:RealFloat">RealFloat</a> a =&gt; a -&gt; <a href="Text-Show.html#t:ShowS">ShowS</a></p><div class="doc"><p>Show a signed <code><a href="Prelude.html#t:RealFloat">RealFloat</a></code> value to full precision
 using standard decimal notation for arguments whose absolute value lies
 between <code>0.1</code> and <code>9,999,999</code>, and scientific notation otherwise.
</p></div></div><div class="top"><p class="src"><a name="v:floatToDigits" class="def">floatToDigits</a> :: <a href="Prelude.html#t:RealFloat">RealFloat</a> a =&gt; <a href="Prelude.html#t:Integer">Integer</a> -&gt; a -&gt; ([<a href="Data-Int.html#t:Int">Int</a>], <a href="Data-Int.html#t:Int">Int</a>)</p><div class="doc"><p><code><a href="Numeric.html#v:floatToDigits">floatToDigits</a></code> takes a base and a non-negative <code><a href="Prelude.html#t:RealFloat">RealFloat</a></code> number,
 and returns a list of digits and an exponent.
 In particular, if <code>x&gt;=0</code>, and
</p><pre> floatToDigits base x = ([d1,d2,...,dn], e)
</pre><p>then
</p><ol><li><pre>n &gt;= 1</pre></li><li><pre>x = 0.d1d2...dn * (base**e)</pre></li><li><pre>0 &lt;= di &lt;= base-1</pre></li></ol></div></div><h1 id="g:2">Reading
</h1><div class="doc"><p><em>NB:</em> <code><a href="Numeric.html#v:readInt">readInt</a></code> is the 'dual' of <code><a href="Numeric.html#v:showIntAtBase">showIntAtBase</a></code>,
 and <code><a href="Numeric.html#v:readDec">readDec</a></code> is the `dual' of <code><a href="Numeric.html#v:showInt">showInt</a></code>.
 The inconsistent naming is a historical accident.
</p></div><div class="top"><p class="src"><a name="v:readSigned" class="def">readSigned</a> :: <a href="Prelude.html#t:Real">Real</a> a =&gt; <a href="Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> a -&gt; <a href="Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> a</p><div class="doc"><p>Reads a <em>signed</em> <code><a href="Prelude.html#t:Real">Real</a></code> value, given a reader for an unsigned value.
</p></div></div><div class="top"><p class="src"><a name="v:readInt" class="def">readInt</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Prelude.html#t:Num">Num</a> a</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">=&gt; a</td><td class="doc"><p>the base
</p></td></tr><tr><td class="src">-&gt; (<a href="Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Bool.html#t:Bool">Bool</a>)</td><td class="doc"><p>a predicate distinguishing valid digits in this base
</p></td></tr><tr><td class="src">-&gt; (<a href="Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Int.html#t:Int">Int</a>)</td><td class="doc"><p>a function converting a valid digit character to an <code><a href="Data-Int.html#t:Int">Int</a></code>
</p></td></tr><tr><td class="src">-&gt; <a href="Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> a</td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p>Reads an <em>unsigned</em> <code><a href="Prelude.html#t:Integral">Integral</a></code> value in an arbitrary base.
</p></div></div><div class="top"><p class="src"><a name="v:readDec" class="def">readDec</a> :: (<a href="Data-Eq.html#t:Eq">Eq</a> a, <a href="Prelude.html#t:Num">Num</a> a) =&gt; <a href="Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> a</p><div class="doc"><p>Read an unsigned number in decimal notation.
</p></div></div><div class="top"><p class="src"><a name="v:readOct" class="def">readOct</a> :: (<a href="Data-Eq.html#t:Eq">Eq</a> a, <a href="Prelude.html#t:Num">Num</a> a) =&gt; <a href="Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> a</p><div class="doc"><p>Read an unsigned number in octal notation.
</p></div></div><div class="top"><p class="src"><a name="v:readHex" class="def">readHex</a> :: (<a href="Data-Eq.html#t:Eq">Eq</a> a, <a href="Prelude.html#t:Num">Num</a> a) =&gt; <a href="Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> a</p><div class="doc"><p>Read an unsigned number in hexadecimal notation.
 Both upper or lower case letters are allowed.
</p></div></div><div class="top"><p class="src"><a name="v:readFloat" class="def">readFloat</a> :: <a href="Prelude.html#t:RealFrac">RealFrac</a> a =&gt; <a href="Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> a</p><div class="doc"><p>Reads an <em>unsigned</em> <code><a href="Prelude.html#t:RealFrac">RealFrac</a></code> value,
 expressed in decimal scientific notation.
</p></div></div><div class="top"><p class="src"><a name="v:lexDigits" class="def">lexDigits</a> :: <a href="Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> <a href="Data-String.html#t:String">String</a></p><div class="doc"><p>Reads a non-empty string of decimal digits.
</p></div></div><h1 id="g:3">Miscellaneous
</h1><div class="top"><p class="src"><a name="v:fromRat" class="def">fromRat</a> :: <a href="Prelude.html#t:RealFloat">RealFloat</a> a =&gt; <a href="Prelude.html#t:Rational">Rational</a> -&gt; a</p><div class="doc"><p>Converts a <code><a href="Prelude.html#t:Rational">Rational</a></code> value into any type in class <code><a href="Prelude.html#t:RealFloat">RealFloat</a></code>.
</p></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>