Sophie

Sophie

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

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>Control.Monad.ST</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_Control-Monad-ST.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 (requires universal quantification for runST)</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Maintainer</th><td>libraries@haskell.org</td></tr><tr><th>Safe Haskell</th><td>Unsafe</td></tr></table><p class="caption">Control.Monad.ST</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">The <code><a href="Control-Monad-ST.html#t:ST">ST</a></code> Monad
</a></li><li><a href="#g:2">Converting <code><a href="Control-Monad-ST.html#t:ST">ST</a></code> to <code><a href="System-IO.html#t:IO">IO</a></code>
</a></li><li><a href="#g:3">Unsafe Functions
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>This library provides support for <em>strict</em> state threads, as
 described in the PLDI '94 paper by John Launchbury and Simon Peyton
 Jones <em>Lazy Functional State Threads</em>.
</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:ST">ST</a> s a</li><li class="src short"><a href="#v:runST">runST</a> ::  (<span class="keyword">forall</span> s.  <a href="Control-Monad-ST.html#t:ST">ST</a> s a) -&gt; a</li><li class="src short"><a href="#v:fixST">fixST</a> ::  (a -&gt; <a href="Control-Monad-ST.html#t:ST">ST</a> s a) -&gt; <a href="Control-Monad-ST.html#t:ST">ST</a> s a</li><li class="src short"><span class="keyword">data</span>  <a href="#t:RealWorld">RealWorld</a> </li><li class="src short"><a href="#v:stToIO">stToIO</a> ::  <a href="Control-Monad-ST.html#t:ST">ST</a> <a href="Control-Monad-ST.html#t:RealWorld">RealWorld</a> a -&gt; <a href="System-IO.html#t:IO">IO</a> a</li><li class="src short"><a href="#v:unsafeInterleaveST">unsafeInterleaveST</a> ::  <a href="Control-Monad-ST.html#t:ST">ST</a> s a -&gt; <a href="Control-Monad-ST.html#t:ST">ST</a> s a</li><li class="src short"><a href="#v:unsafeIOToST">unsafeIOToST</a> ::  <a href="System-IO.html#t:IO">IO</a> a -&gt; <a href="Control-Monad-ST.html#t:ST">ST</a> s a</li><li class="src short"><a href="#v:unsafeSTToIO">unsafeSTToIO</a> ::  <a href="Control-Monad-ST.html#t:ST">ST</a> s a -&gt; <a href="System-IO.html#t:IO">IO</a> a</li></ul></div><div id="interface"><h1 id="g:1">The <code><a href="Control-Monad-ST.html#t:ST">ST</a></code> Monad
</h1><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:ST" class="def">ST</a> s a </p><div class="doc"><p>The strict state-transformer monad.
 A computation of type <code><code><a href="Control-Monad-ST.html#t:ST">ST</a></code> s a</code> transforms an internal state indexed
 by <code>s</code>, and returns a value of type <code>a</code>.
 The <code>s</code> parameter is either
</p><ul><li> an uninstantiated type variable (inside invocations of <code><a href="Control-Monad-ST.html#v:runST">runST</a></code>), or
</li><li> <code><a href="Control-Monad-ST.html#t:RealWorld">RealWorld</a></code> (inside invocations of <code><a href="Control-Monad-ST.html#v:stToIO">stToIO</a></code>).
</li></ul><p>It serves to keep the internal states of different invocations
 of <code><a href="Control-Monad-ST.html#v:runST">runST</a></code> separate from each other and from invocations of
 <code><a href="Control-Monad-ST.html#v:stToIO">stToIO</a></code>.
</p><p>The <code><a href="Control-Monad.html#v:-62--62--61-">&gt;&gt;=</a></code> and <code><a href="Control-Monad.html#v:-62--62-">&gt;&gt;</a></code> operations are strict in the state (though not in
 values stored in the state).  For example,
</p><pre><code><a href="Control-Monad-ST.html#v:runST">runST</a></code> (writeSTRef _|_ v &gt;&gt;= f) = _|_</pre></div><div class="subs instances"><p id="control.i:ST" class="caption collapser" onclick="toggleSection('i:ST')">Instances</p><div id="section.i:ST" class="show"><table><tr><td class="src"><a href="Data-Typeable-Internal.html#t:Typeable2">Typeable2</a> <a href="Control-Monad-ST.html#t:ST">ST</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Control-Monad.html#t:Monad">Monad</a> (<a href="Control-Monad-ST.html#t:ST">ST</a> s)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Control-Monad.html#t:Functor">Functor</a> (<a href="Control-Monad-ST.html#t:ST">ST</a> s)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Control-Monad-Fix.html#t:MonadFix">MonadFix</a> (<a href="Control-Monad-ST.html#t:ST">ST</a> s)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Control-Applicative.html#t:Applicative">Applicative</a> (<a href="Control-Monad-ST.html#t:ST">ST</a> s)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Text-Show.html#t:Show">Show</a> (<a href="Control-Monad-ST.html#t:ST">ST</a> s a)</td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:runST" class="def">runST</a> ::  (<span class="keyword">forall</span> s.  <a href="Control-Monad-ST.html#t:ST">ST</a> s a) -&gt; a</p><div class="doc"><p>Return the value computed by a state transformer computation.
 The <code>forall</code> ensures that the internal state used by the <code><a href="Control-Monad-ST.html#t:ST">ST</a></code>
 computation is inaccessible to the rest of the program.
</p></div></div><div class="top"><p class="src"><a name="v:fixST" class="def">fixST</a> ::  (a -&gt; <a href="Control-Monad-ST.html#t:ST">ST</a> s a) -&gt; <a href="Control-Monad-ST.html#t:ST">ST</a> s a</p><div class="doc"><p>Allow the result of a state transformer computation to be used (lazily)
 inside the computation.
 Note that if <code>f</code> is strict, <code><code><a href="Control-Monad-ST.html#v:fixST">fixST</a></code> f = _|_</code>.
</p></div></div><h1 id="g:2">Converting <code><a href="Control-Monad-ST.html#t:ST">ST</a></code> to <code><a href="System-IO.html#t:IO">IO</a></code>
</h1><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:RealWorld" class="def">RealWorld</a>  <a href="../ghc-prim-0.2.0.0/src/GHC-Prim.html#RealWorld" class="link">Source</a></p><div class="doc"><p><code>RealWorld</code> is deeply magical.  It is <em>primitive</em>, but it is not
 	<em>unlifted</em> (hence <code>ptrArg</code>).  We never manipulate values of type
 	<code>RealWorld</code>; it's only used in the type system, to parameterise <code>State#</code>. 
</p></div><div class="subs instances"><p id="control.i:RealWorld" class="caption collapser" onclick="toggleSection('i:RealWorld')">Instances</p><div id="section.i:RealWorld" class="show"><table><tr><td class="src"><a href="Data-Typeable-Internal.html#t:Typeable">Typeable</a> <a href="Control-Monad-ST.html#t:RealWorld">RealWorld</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:stToIO" class="def">stToIO</a> ::  <a href="Control-Monad-ST.html#t:ST">ST</a> <a href="Control-Monad-ST.html#t:RealWorld">RealWorld</a> a -&gt; <a href="System-IO.html#t:IO">IO</a> a</p><div class="doc"><p>A monad transformer embedding strict state transformers in the <code><a href="System-IO.html#t:IO">IO</a></code>
 monad.  The <code><a href="Control-Monad-ST.html#t:RealWorld">RealWorld</a></code> parameter indicates that the internal state
 used by the <code><a href="Control-Monad-ST.html#t:ST">ST</a></code> computation is a special one supplied by the <code><a href="System-IO.html#t:IO">IO</a></code>
 monad, and thus distinct from those used by invocations of <code><a href="Control-Monad-ST.html#v:runST">runST</a></code>.
</p></div></div><h1 id="g:3">Unsafe Functions
</h1><div class="top"><p class="src"><a name="v:unsafeInterleaveST" class="def">unsafeInterleaveST</a> ::  <a href="Control-Monad-ST.html#t:ST">ST</a> s a -&gt; <a href="Control-Monad-ST.html#t:ST">ST</a> s a</p><div class="doc"><div class="warning"><p>Deprecated: Please import from Control.Monad.ST.Unsafe instead; This will be removed in the next release</p></div></div></div><div class="top"><p class="src"><a name="v:unsafeIOToST" class="def">unsafeIOToST</a> ::  <a href="System-IO.html#t:IO">IO</a> a -&gt; <a href="Control-Monad-ST.html#t:ST">ST</a> s a</p><div class="doc"><div class="warning"><p>Deprecated: Please import from Control.Monad.ST.Unsafe instead; This will be removed in the next release</p></div></div></div><div class="top"><p class="src"><a name="v:unsafeSTToIO" class="def">unsafeSTToIO</a> ::  <a href="Control-Monad-ST.html#t:ST">ST</a> s a -&gt; <a href="System-IO.html#t:IO">IO</a> a</p><div class="doc"><div class="warning"><p>Deprecated: Please import from Control.Monad.ST.Unsafe instead; This will be removed in the next release</p></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>