Sophie

Sophie

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

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>Array</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_Array.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">haskell98-2.0.0.1: Compatibility with Haskell 98</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>Trustworthy</td></tr></table><p class="caption">Array</p></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">module <a href="Ix.html">Ix</a></li><li class="src short"><span class="keyword">data</span>  <a href="#t:Array">Array</a> i e</li><li class="src short"><a href="#v:array">array</a> :: <a href="Ix.html#t:Ix">Ix</a> i =&gt; (i, i) -&gt; [(i, e)] -&gt; <a href="Array.html#t:Array">Array</a> i e</li><li class="src short"><a href="#v:listArray">listArray</a> :: <a href="Ix.html#t:Ix">Ix</a> i =&gt; (i, i) -&gt; [e] -&gt; <a href="Array.html#t:Array">Array</a> i e</li><li class="src short"><a href="#v:-33-">(!)</a> :: <a href="Ix.html#t:Ix">Ix</a> i =&gt; <a href="Array.html#t:Array">Array</a> i e -&gt; i -&gt; e</li><li class="src short"><a href="#v:bounds">bounds</a> :: <a href="Ix.html#t:Ix">Ix</a> i =&gt; <a href="Array.html#t:Array">Array</a> i e -&gt; (i, i)</li><li class="src short"><a href="#v:indices">indices</a> :: <a href="Ix.html#t:Ix">Ix</a> i =&gt; <a href="Array.html#t:Array">Array</a> i e -&gt; [i]</li><li class="src short"><a href="#v:elems">elems</a> :: <a href="Ix.html#t:Ix">Ix</a> i =&gt; <a href="Array.html#t:Array">Array</a> i e -&gt; [e]</li><li class="src short"><a href="#v:assocs">assocs</a> :: <a href="Ix.html#t:Ix">Ix</a> i =&gt; <a href="Array.html#t:Array">Array</a> i e -&gt; [(i, e)]</li><li class="src short"><a href="#v:accumArray">accumArray</a> :: <a href="Ix.html#t:Ix">Ix</a> i =&gt; (e -&gt; a -&gt; e) -&gt; e -&gt; (i, i) -&gt; [(i, a)] -&gt; <a href="Array.html#t:Array">Array</a> i e</li><li class="src short"><a href="#v:-47--47-">(//)</a> :: <a href="Ix.html#t:Ix">Ix</a> i =&gt; <a href="Array.html#t:Array">Array</a> i e -&gt; [(i, e)] -&gt; <a href="Array.html#t:Array">Array</a> i e</li><li class="src short"><a href="#v:accum">accum</a> :: <a href="Ix.html#t:Ix">Ix</a> i =&gt; (e -&gt; a -&gt; e) -&gt; <a href="Array.html#t:Array">Array</a> i e -&gt; [(i, a)] -&gt; <a href="Array.html#t:Array">Array</a> i e</li><li class="src short"><a href="#v:ixmap">ixmap</a> :: (<a href="Ix.html#t:Ix">Ix</a> i, <a href="Ix.html#t:Ix">Ix</a> j) =&gt; (i, i) -&gt; (i -&gt; j) -&gt; <a href="Array.html#t:Array">Array</a> j e -&gt; <a href="Array.html#t:Array">Array</a> i e</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src">module <a href="Ix.html">Ix</a></p></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:Array" class="def">Array</a> i e <a href="../base-4.5.1.0/src/GHC-Arr.html#Array" class="link">Source</a></p><div class="doc"><p>The type of immutable non-strict (boxed) arrays
 with indices in <code>i</code> and elements in <code>e</code>.
</p></div><div class="subs instances"><p id="control.i:Array" class="caption collapser" onclick="toggleSection('i:Array')">Instances</p><div id="section.i:Array" class="show"><table><tr><td class="src"><a href="../base-4.5.1.0/Data-Typeable-Internal.html#t:Typeable2">Typeable2</a> <a href="Array.html#t:Array">Array</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Ix.html#t:Ix">Ix</a> i =&gt; <a href="Prelude.html#t:Functor">Functor</a> (<a href="Array.html#t:Array">Array</a> i)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">(<a href="Ix.html#t:Ix">Ix</a> i, <a href="Prelude.html#t:Eq">Eq</a> e) =&gt; <a href="Prelude.html#t:Eq">Eq</a> (<a href="Array.html#t:Array">Array</a> i e)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">(<a href="Ix.html#t:Ix">Ix</a> i, <a href="Prelude.html#t:Ord">Ord</a> e) =&gt; <a href="Prelude.html#t:Ord">Ord</a> (<a href="Array.html#t:Array">Array</a> i e)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">(<a href="Ix.html#t:Ix">Ix</a> a, <a href="Prelude.html#t:Read">Read</a> a, <a href="Prelude.html#t:Read">Read</a> b) =&gt; <a href="Prelude.html#t:Read">Read</a> (<a href="Array.html#t:Array">Array</a> a b)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">(<a href="Ix.html#t:Ix">Ix</a> a, <a href="Prelude.html#t:Show">Show</a> a, <a href="Prelude.html#t:Show">Show</a> b) =&gt; <a href="Prelude.html#t:Show">Show</a> (<a href="Array.html#t:Array">Array</a> a b)</td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:array" class="def">array</a><a href="../base-4.5.1.0/src/GHC-Arr.html#array" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Ix.html#t:Ix">Ix</a> i</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">=&gt; (i, i)</td><td class="doc"><p>a pair of <em>bounds</em>, each of the index type
 of the array.  These bounds are the lowest and
 highest indices in the array, in that order.
 For example, a one-origin vector of length
 '10' has bounds '(1,10)', and a one-origin '10'
 by '10' matrix has bounds '((1,1),(10,10))'.
</p></td></tr><tr><td class="src">-&gt; [(i, e)]</td><td class="doc"><p>a list of <em>associations</em> of the form
 (<em>index</em>, <em>value</em>).  Typically, this list will
 be expressed as a comprehension.  An
 association '(i, x)' defines the value of
 the array at index <code>i</code> to be <code>x</code>.
</p></td></tr><tr><td class="src">-&gt; <a href="Array.html#t:Array">Array</a> i e</td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p>Construct an array with the specified bounds and containing values
 for given indices within these bounds.
</p><p>The array is undefined (i.e. bottom) if any index in the list is
 out of bounds.  The Haskell 98 Report further specifies that if any
 two associations in the list have the same index, the value at that
 index is undefined (i.e. bottom).  However in GHC's implementation,
 the value at such an index is the value part of the last association
 with that index in the list.
</p><p>Because the indices must be checked for these errors, <code><a href="Array.html#v:array">array</a></code> is
 strict in the bounds argument and in the indices of the association
 list, but non-strict in the values.  Thus, recurrences such as the
 following are possible:
</p><pre> a = array (1,100) ((1,1) : [(i, i * a!(i-1)) | i &lt;- [2..100]])
</pre><p>Not every index within the bounds of the array need appear in the
 association list, but the values associated with indices that do not
 appear will be undefined (i.e. bottom).
</p><p>If, in any dimension, the lower bound is greater than the upper bound,
 then the array is legal, but empty.  Indexing an empty array always
 gives an array-bounds error, but <code><a href="Array.html#v:bounds">bounds</a></code> still yields the bounds
 with which the array was constructed.
</p></div></div><div class="top"><p class="src"><a name="v:listArray" class="def">listArray</a> :: <a href="Ix.html#t:Ix">Ix</a> i =&gt; (i, i) -&gt; [e] -&gt; <a href="Array.html#t:Array">Array</a> i e<a href="../base-4.5.1.0/src/GHC-Arr.html#listArray" class="link">Source</a></p><div class="doc"><p>Construct an array from a pair of bounds and a list of values in
 index order.
</p></div></div><div class="top"><p class="src"><a name="v:-33-" class="def">(!)</a> :: <a href="Ix.html#t:Ix">Ix</a> i =&gt; <a href="Array.html#t:Array">Array</a> i e -&gt; i -&gt; e<a href="../base-4.5.1.0/src/GHC-Arr.html#%21" class="link">Source</a></p><div class="doc"><p>The value at the given index in an array.
</p></div></div><div class="top"><p class="src"><a name="v:bounds" class="def">bounds</a> :: <a href="Ix.html#t:Ix">Ix</a> i =&gt; <a href="Array.html#t:Array">Array</a> i e -&gt; (i, i)<a href="../base-4.5.1.0/src/GHC-Arr.html#bounds" class="link">Source</a></p><div class="doc"><p>The bounds with which an array was constructed.
</p></div></div><div class="top"><p class="src"><a name="v:indices" class="def">indices</a> :: <a href="Ix.html#t:Ix">Ix</a> i =&gt; <a href="Array.html#t:Array">Array</a> i e -&gt; [i]<a href="../base-4.5.1.0/src/GHC-Arr.html#indices" class="link">Source</a></p><div class="doc"><p>The list of indices of an array in ascending order.
</p></div></div><div class="top"><p class="src"><a name="v:elems" class="def">elems</a> :: <a href="Ix.html#t:Ix">Ix</a> i =&gt; <a href="Array.html#t:Array">Array</a> i e -&gt; [e]<a href="../base-4.5.1.0/src/GHC-Arr.html#elems" class="link">Source</a></p><div class="doc"><p>The list of elements of an array in index order.
</p></div></div><div class="top"><p class="src"><a name="v:assocs" class="def">assocs</a> :: <a href="Ix.html#t:Ix">Ix</a> i =&gt; <a href="Array.html#t:Array">Array</a> i e -&gt; [(i, e)]<a href="../base-4.5.1.0/src/GHC-Arr.html#assocs" class="link">Source</a></p><div class="doc"><p>The list of associations of an array in index order.
</p></div></div><div class="top"><p class="src"><a name="v:accumArray" class="def">accumArray</a><a href="../base-4.5.1.0/src/GHC-Arr.html#accumArray" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Ix.html#t:Ix">Ix</a> i</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">=&gt; (e -&gt; a -&gt; e)</td><td class="doc"><p>accumulating function
</p></td></tr><tr><td class="src">-&gt; e</td><td class="doc"><p>initial value
</p></td></tr><tr><td class="src">-&gt; (i, i)</td><td class="doc"><p>bounds of the array
</p></td></tr><tr><td class="src">-&gt; [(i, a)]</td><td class="doc"><p>association list
</p></td></tr><tr><td class="src">-&gt; <a href="Array.html#t:Array">Array</a> i e</td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p>The <code><a href="Array.html#v:accumArray">accumArray</a></code> function deals with repeated indices in the association
 list using an <em>accumulating function</em> which combines the values of
 associations with the same index.
 For example, given a list of values of some index type, <code>hist</code>
 produces a histogram of the number of occurrences of each index within
 a specified range:
</p><pre> hist :: (Ix a, Num b) =&gt; (a,a) -&gt; [a] -&gt; Array a b
 hist bnds is = accumArray (+) 0 bnds [(i, 1) | i&lt;-is, inRange bnds i]
</pre><p>If the accumulating function is strict, then <code><a href="Array.html#v:accumArray">accumArray</a></code> is strict in
 the values, as well as the indices, in the association list.  Thus,
 unlike ordinary arrays built with <code><a href="Array.html#v:array">array</a></code>, accumulated arrays should
 not in general be recursive.
</p></div></div><div class="top"><p class="src"><a name="v:-47--47-" class="def">(//)</a> :: <a href="Ix.html#t:Ix">Ix</a> i =&gt; <a href="Array.html#t:Array">Array</a> i e -&gt; [(i, e)] -&gt; <a href="Array.html#t:Array">Array</a> i e<a href="../base-4.5.1.0/src/GHC-Arr.html#%2F%2F" class="link">Source</a></p><div class="doc"><p>Constructs an array identical to the first argument except that it has
 been updated by the associations in the right argument.
 For example, if <code>m</code> is a 1-origin, <code>n</code> by <code>n</code> matrix, then
</p><pre> m//[((i,i), 0) | i &lt;- [1..n]]
</pre><p>is the same matrix, except with the diagonal zeroed.
</p><p>Repeated indices in the association list are handled as for <code><a href="Array.html#v:array">array</a></code>:
 Haskell 98 specifies that the resulting array is undefined (i.e. bottom),
 but GHC's implementation uses the last association for each index.
</p></div></div><div class="top"><p class="src"><a name="v:accum" class="def">accum</a> :: <a href="Ix.html#t:Ix">Ix</a> i =&gt; (e -&gt; a -&gt; e) -&gt; <a href="Array.html#t:Array">Array</a> i e -&gt; [(i, a)] -&gt; <a href="Array.html#t:Array">Array</a> i e<a href="../base-4.5.1.0/src/GHC-Arr.html#accum" class="link">Source</a></p><div class="doc"><p><code><code><a href="Array.html#v:accum">accum</a></code> f</code> takes an array and an association list and accumulates
 pairs from the list into the array with the accumulating function <code>f</code>.
 Thus <code><a href="Array.html#v:accumArray">accumArray</a></code> can be defined using <code><a href="Array.html#v:accum">accum</a></code>:
</p><pre> accumArray f z b = accum f (array b [(i, z) | i &lt;- range b])
</pre></div></div><div class="top"><p class="src"><a name="v:ixmap" class="def">ixmap</a> :: (<a href="Ix.html#t:Ix">Ix</a> i, <a href="Ix.html#t:Ix">Ix</a> j) =&gt; (i, i) -&gt; (i -&gt; j) -&gt; <a href="Array.html#t:Array">Array</a> j e -&gt; <a href="Array.html#t:Array">Array</a> i e<a href="../base-4.5.1.0/src/GHC-Arr.html#ixmap" class="link">Source</a></p><div class="doc"><p><code><a href="Array.html#v:ixmap">ixmap</a></code> allows for transformations on array indices.
 It may be thought of as providing function composition on the right
 with the mapping that the original array embodies.
</p><p>A similar transformation of array values may be achieved using <code><a href="Prelude.html#v:fmap">fmap</a></code>
 from the <code><a href="Array.html#t:Array">Array</a></code> instance of the <code><a href="Prelude.html#t:Functor">Functor</a></code> class.
</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>