/usr/share/doc/libghc-adjunctions-doc/html/Control-Monad-Representable-State.html is in libghc-adjunctions-doc 4.2.2-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <!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.Representable.State</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-Representable-State.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Control-Monad-Representable-State.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">adjunctions-4.2.2: Adjunctions and representable functors</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Copyright</th><td>(c) Edward Kmett & Sjoerd Visscher 2011</td></tr><tr><th>License</th><td>BSD3</td></tr><tr><th>Maintainer</th><td>ekmett@gmail.com</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Control.Monad.Representable.State</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>A generalized State monad, parameterized by a Representable functor.
The representation of that functor serves as the state.</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">type</span> <a href="#t:State">State</a> g = <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor-Identity.html#t:Identity">Identity</a></li><li class="src short"><a href="#v:runState">runState</a> :: <a href="Data-Functor-Rep.html#t:Representable">Representable</a> g => <a href="Control-Monad-Representable-State.html#t:State">State</a> g a -> <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g -> (a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g)</li><li class="src short"><a href="#v:evalState">evalState</a> :: <a href="Data-Functor-Rep.html#t:Representable">Representable</a> g => <a href="Control-Monad-Representable-State.html#t:State">State</a> g a -> <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g -> a</li><li class="src short"><a href="#v:execState">execState</a> :: <a href="Data-Functor-Rep.html#t:Representable">Representable</a> g => <a href="Control-Monad-Representable-State.html#t:State">State</a> g a -> <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g -> <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g</li><li class="src short"><a href="#v:mapState">mapState</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> g => ((a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g) -> (b, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g)) -> <a href="Control-Monad-Representable-State.html#t:State">State</a> g a -> <a href="Control-Monad-Representable-State.html#t:State">State</a> g b</li><li class="src short"><span class="keyword">newtype</span> <a href="#t:StateT">StateT</a> g m a = <a href="#v:StateT">StateT</a> {<ul class="subs"><li><a href="#v:getStateT">getStateT</a> :: g (m (a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g))</li></ul>}</li><li class="src short"><a href="#v:stateT">stateT</a> :: <a href="Data-Functor-Rep.html#t:Representable">Representable</a> g => (<a href="Data-Functor-Rep.html#t:Rep">Rep</a> g -> m (a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g)) -> <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m a</li><li class="src short"><a href="#v:runStateT">runStateT</a> :: <a href="Data-Functor-Rep.html#t:Representable">Representable</a> g => <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m a -> <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g -> m (a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g)</li><li class="src short"><a href="#v:evalStateT">evalStateT</a> :: (<a href="Data-Functor-Rep.html#t:Representable">Representable</a> g, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m) => <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m a -> <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g -> m a</li><li class="src short"><a href="#v:execStateT">execStateT</a> :: (<a href="Data-Functor-Rep.html#t:Representable">Representable</a> g, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m) => <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m a -> <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g -> m (<a href="Data-Functor-Rep.html#t:Rep">Rep</a> g)</li><li class="src short"><a href="#v:mapStateT">mapStateT</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> g => (m (a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g) -> n (b, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g)) -> <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m a -> <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g n b</li><li class="src short"><a href="#v:liftCallCC">liftCallCC</a> :: <a href="Data-Functor-Rep.html#t:Representable">Representable</a> g => ((((a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g) -> m (b, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g)) -> m (a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g)) -> m (a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g)) -> ((a -> <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m b) -> <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m a) -> <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m a</li><li class="src short"><a href="#v:liftCallCC-39-">liftCallCC'</a> :: <a href="Data-Functor-Rep.html#t:Representable">Representable</a> g => ((((a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g) -> m (b, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g)) -> m (a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g)) -> m (a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g)) -> ((a -> <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m b) -> <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m a) -> <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m a</li><li class="src short"><span class="keyword">class</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="#t:MonadState">MonadState</a> s m | m -> s <span class="keyword">where</span><ul class="subs"><li><a href="#v:get">get</a> :: m s</li><li><a href="#v:put">put</a> :: s -> m ()</li><li><a href="#v:state">state</a> :: (s -> (a, s)) -> m a</li></ul></li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:State" class="def">State</a> g = <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor-Identity.html#t:Identity">Identity</a> <a href="src/Control-Monad-Representable-State.html#State" class="link">Source</a></p><div class="doc"><p>A memoized state monad parameterized by a representable functor <code>g</code>, where
the representatation of <code>g</code>, <code>Rep g</code> is the state to carry.</p><p>The <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#v:return">return</a></code> function leaves the state unchanged, while <code>>>=</code> uses
the final state of the first computation as the initial state of
the second.</p></div></div><div class="top"><p class="src"><a name="v:runState" class="def">runState</a> <a href="src/Control-Monad-Representable-State.html#runState" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Data-Functor-Rep.html#t:Representable">Representable</a> g</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="Control-Monad-Representable-State.html#t:State">State</a> g a</td><td class="doc"><p>state-passing computation to execute</p></td></tr><tr><td class="src">-> <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g</td><td class="doc"><p>initial state</p></td></tr><tr><td class="src">-> (a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g)</td><td class="doc"><p>return value and final state</p></td></tr></table></div><div class="doc"><p>Unwrap a state monad computation as a function.
(The inverse of <code><a href="Control-Monad-Representable-State.html#v:state">state</a></code>.)</p></div></div><div class="top"><p class="src"><a name="v:evalState" class="def">evalState</a> <a href="src/Control-Monad-Representable-State.html#evalState" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Data-Functor-Rep.html#t:Representable">Representable</a> g</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="Control-Monad-Representable-State.html#t:State">State</a> g a</td><td class="doc"><p>state-passing computation to execute</p></td></tr><tr><td class="src">-> <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g</td><td class="doc"><p>initial value</p></td></tr><tr><td class="src">-> a</td><td class="doc"><p>return value of the state computation</p></td></tr></table></div><div class="doc"><p>Evaluate a state computation with the given initial state
and return the final value, discarding the final state.</p><ul><li><pre><code><a href="Control-Monad-Representable-State.html#v:evalState">evalState</a></code> m s = <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Tuple.html#v:fst">fst</a></code> (<code><a href="Control-Monad-Representable-State.html#v:runState">runState</a></code> m s)</pre></li></ul></div></div><div class="top"><p class="src"><a name="v:execState" class="def">execState</a> <a href="src/Control-Monad-Representable-State.html#execState" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Data-Functor-Rep.html#t:Representable">Representable</a> g</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="Control-Monad-Representable-State.html#t:State">State</a> g a</td><td class="doc"><p>state-passing computation to execute</p></td></tr><tr><td class="src">-> <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g</td><td class="doc"><p>initial value</p></td></tr><tr><td class="src">-> <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g</td><td class="doc"><p>final state</p></td></tr></table></div><div class="doc"><p>Evaluate a state computation with the given initial state
and return the final state, discarding the final value.</p><ul><li><pre><code><a href="Control-Monad-Representable-State.html#v:execState">execState</a></code> m s = <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Tuple.html#v:snd">snd</a></code> (<code><a href="Control-Monad-Representable-State.html#v:runState">runState</a></code> m s)</pre></li></ul></div></div><div class="top"><p class="src"><a name="v:mapState" class="def">mapState</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> g => ((a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g) -> (b, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g)) -> <a href="Control-Monad-Representable-State.html#t:State">State</a> g a -> <a href="Control-Monad-Representable-State.html#t:State">State</a> g b <a href="src/Control-Monad-Representable-State.html#mapState" class="link">Source</a></p><div class="doc"><p>Map both the return value and final state of a computation using
the given function.</p><ul><li><pre><code><a href="Control-Monad-Representable-State.html#v:runState">runState</a></code> (<code><a href="Control-Monad-Representable-State.html#v:mapState">mapState</a></code> f m) = f . <code><a href="Control-Monad-Representable-State.html#v:runState">runState</a></code> m</pre></li></ul></div></div><div class="top"><p class="src"><span class="keyword">newtype</span> <a name="t:StateT" class="def">StateT</a> g m a <a href="src/Control-Monad-Representable-State.html#StateT" class="link">Source</a></p><div class="doc"><p>A state transformer monad parameterized by:</p><ul><li><code>g</code> - A representable functor used to memoize results for a state <code>Rep g</code></li><li><code>m</code> - The inner monad.</li></ul><p>The <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#v:return">return</a></code> function leaves the state unchanged, while <code>>>=</code> uses
the final state of the first computation as the initial state of
the second.</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:StateT" class="def">StateT</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><dl><dt class="src"><a name="v:getStateT" class="def">getStateT</a> :: g (m (a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g))</dt><dd class="doc empty"> </dd></dl><div class="clear"></div></div></td></tr></table></div><div class="subs instances"><p id="control.i:StateT" class="caption collapser" onclick="toggleSection('i:StateT')">Instances</p><div id="section.i:StateT" class="show"><table><tr><td class="src clearfix"><span class="inst-left">(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> f, <a href="Data-Functor-Rep.html#t:Representable">Representable</a> g, <a href="file:///usr/share/doc/libghc-free-doc/html/Control-Monad-Free-Class.html#t:MonadFree">MonadFree</a> f m) => <a href="file:///usr/share/doc/libghc-free-doc/html/Control-Monad-Free-Class.html#t:MonadFree">MonadFree</a> f (<a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m)</span> <a href="src/Control-Monad-Representable-State.html#line-182" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Data-Functor-Rep.html#t:Representable">Representable</a> g, <a href="Control-Monad-Representable-Reader.html#t:MonadReader">MonadReader</a> e m) => <a href="Control-Monad-Representable-Reader.html#t:MonadReader">MonadReader</a> e (<a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m)</span> <a href="src/Control-Monad-Representable-State.html#line-166" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Data-Functor-Rep.html#t:Representable">Representable</a> g, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m, (~) * (<a href="Data-Functor-Rep.html#t:Rep">Rep</a> g) s) => <a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s (<a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m)</span> <a href="src/Control-Monad-Representable-State.html#line-159" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Data-Functor-Rep.html#t:Representable">Representable</a> g, <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Writer-Class.html#t:MonadWriter">MonadWriter</a> w m) => <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Writer-Class.html#t:MonadWriter">MonadWriter</a> w (<a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m)</span> <a href="src/Control-Monad-Representable-State.html#line-170" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Data-Functor-Rep.html#t:Representable">Representable</a> f => <a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-Trans-Class.html#t:MonadTrans">MonadTrans</a> (<a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> f)</span> <a href="src/Control-Monad-Representable-State.html#line-156" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Data-Functor-Rep.html#t:Representable">Representable</a> f => <a href="file:///usr/share/doc/libghc-semigroupoids-doc/html/Data-Functor-Bind-Trans.html#t:BindTrans">BindTrans</a> (<a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> f)</span> <a href="src/Control-Monad-Representable-State.html#line-153" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Data-Functor-Rep.html#t:Representable">Representable</a> g, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> (<a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m)</span> <a href="src/Control-Monad-Representable-State.html#line-149" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> g, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> m) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> (<a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m)</span> <a href="src/Control-Monad-Representable-State.html#line-136" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Data-Functor-Rep.html#t:Representable">Representable</a> g, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> (<a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m)</span> <a href="src/Control-Monad-Representable-State.html#line-142" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Data-Functor-Rep.html#t:Representable">Representable</a> g, <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Cont-Class.html#t:MonadCont">MonadCont</a> m) => <a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Cont-Class.html#t:MonadCont">MonadCont</a> (<a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m)</span> <a href="src/Control-Monad-Representable-State.html#line-179" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Data-Functor-Rep.html#t:Representable">Representable</a> g, <a href="file:///usr/share/doc/libghc-semigroupoids-doc/html/Data-Functor-Bind.html#t:Bind">Bind</a> m) => <a href="file:///usr/share/doc/libghc-semigroupoids-doc/html/Data-Functor-Apply.html#t:Apply">Apply</a> (<a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m)</span> <a href="src/Control-Monad-Representable-State.html#line-139" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Data-Functor-Rep.html#t:Representable">Representable</a> g, <a href="file:///usr/share/doc/libghc-semigroupoids-doc/html/Data-Functor-Bind.html#t:Bind">Bind</a> m) => <a href="file:///usr/share/doc/libghc-semigroupoids-doc/html/Data-Functor-Bind.html#t:Bind">Bind</a> (<a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m)</span> <a href="src/Control-Monad-Representable-State.html#line-146" class="link">Source</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:stateT" class="def">stateT</a> :: <a href="Data-Functor-Rep.html#t:Representable">Representable</a> g => (<a href="Data-Functor-Rep.html#t:Rep">Rep</a> g -> m (a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g)) -> <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m a <a href="src/Control-Monad-Representable-State.html#stateT" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:runStateT" class="def">runStateT</a> :: <a href="Data-Functor-Rep.html#t:Representable">Representable</a> g => <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m a -> <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g -> m (a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g) <a href="src/Control-Monad-Representable-State.html#runStateT" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:evalStateT" class="def">evalStateT</a> :: (<a href="Data-Functor-Rep.html#t:Representable">Representable</a> g, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m) => <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m a -> <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g -> m a <a href="src/Control-Monad-Representable-State.html#evalStateT" class="link">Source</a></p><div class="doc"><p>Evaluate a state computation with the given initial state
and return the final value, discarding the final state.</p><ul><li><pre><code><a href="Control-Monad-Representable-State.html#v:evalStateT">evalStateT</a></code> m s = <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#v:liftM">liftM</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Tuple.html#v:fst">fst</a></code> (<code><a href="Control-Monad-Representable-State.html#v:runStateT">runStateT</a></code> m s)</pre></li></ul></div></div><div class="top"><p class="src"><a name="v:execStateT" class="def">execStateT</a> :: (<a href="Data-Functor-Rep.html#t:Representable">Representable</a> g, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m) => <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m a -> <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g -> m (<a href="Data-Functor-Rep.html#t:Rep">Rep</a> g) <a href="src/Control-Monad-Representable-State.html#execStateT" class="link">Source</a></p><div class="doc"><p>Evaluate a state computation with the given initial state
and return the final state, discarding the final value.</p><ul><li><pre><code><a href="Control-Monad-Representable-State.html#v:execStateT">execStateT</a></code> m s = <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#v:liftM">liftM</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Tuple.html#v:snd">snd</a></code> (<code><a href="Control-Monad-Representable-State.html#v:runStateT">runStateT</a></code> m s)</pre></li></ul></div></div><div class="top"><p class="src"><a name="v:mapStateT" class="def">mapStateT</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> g => (m (a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g) -> n (b, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g)) -> <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m a -> <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g n b <a href="src/Control-Monad-Representable-State.html#mapStateT" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:liftCallCC" class="def">liftCallCC</a> :: <a href="Data-Functor-Rep.html#t:Representable">Representable</a> g => ((((a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g) -> m (b, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g)) -> m (a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g)) -> m (a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g)) -> ((a -> <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m b) -> <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m a) -> <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m a <a href="src/Control-Monad-Representable-State.html#liftCallCC" class="link">Source</a></p><div class="doc"><p>Uniform lifting of a <code>callCC</code> operation to the new monad.
This version rolls back to the original state on entering the
continuation.</p></div></div><div class="top"><p class="src"><a name="v:liftCallCC-39-" class="def">liftCallCC'</a> :: <a href="Data-Functor-Rep.html#t:Representable">Representable</a> g => ((((a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g) -> m (b, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g)) -> m (a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g)) -> m (a, <a href="Data-Functor-Rep.html#t:Rep">Rep</a> g)) -> ((a -> <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m b) -> <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m a) -> <a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m a <a href="src/Control-Monad-Representable-State.html#liftCallCC%27" class="link">Source</a></p><div class="doc"><p>In-situ lifting of a <code>callCC</code> operation to the new monad.
This version uses the current state on entering the continuation.
It does not satisfy the laws of a monad transformer.</p></div></div><div class="top"><p class="src"><span class="keyword">class</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m => <a name="t:MonadState" class="def">MonadState</a> s m | m -> s <span class="keyword">where</span></p><div class="doc"><p>Minimal definition is either both of <code>get</code> and <code>put</code> or just <code>state</code></p></div><div class="subs minimal"><p class="caption">Minimal complete definition</p><p class="src"><a href="Control-Monad-Representable-State.html#v:state">state</a> | <a href="Control-Monad-Representable-State.html#v:get">get</a>, <a href="Control-Monad-Representable-State.html#v:put">put</a></p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:get" class="def">get</a> :: m s</p><div class="doc"><p>Return the state from the internals of the monad.</p></div><p class="src"><a name="v:put" class="def">put</a> :: s -> m ()</p><div class="doc"><p>Replace the state inside the monad.</p></div><p class="src"><a name="v:state" class="def">state</a> :: (s -> (a, s)) -> m a</p><div class="doc"><p>Embed a simple state action into the monad.</p></div></div><div class="subs instances"><p id="control.i:MonadState" class="caption collapser" onclick="toggleSection('i:MonadState')">Instances</p><div id="section.i:MonadState" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s m => <a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-Trans-Maybe.html#t:MaybeT">MaybeT</a> m)</span></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s m => <a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s (<a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-List.html#t:ListT">ListT</a> m)</span></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s m => <a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s (<a href="file:///usr/share/doc/libghc-comonad-doc/html/Control-Comonad-Trans-Identity.html#t:IdentityT">IdentityT</a> m)</span></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> m, <a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s m) => <a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s (<a href="file:///usr/share/doc/libghc-free-doc/html/Control-Monad-Free.html#t:Free">Free</a> m)</span></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Data-Functor-Rep.html#t:Representable">Representable</a> g, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m, (~) * (<a href="Data-Functor-Rep.html#t:Rep">Rep</a> g) s) => <a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s (<a href="Control-Monad-Representable-State.html#t:StateT">StateT</a> g m)</span></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> w, <a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s m) => <a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s (<a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Writer-Lazy.html#t:WriterT">WriterT</a> w m)</span></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> w, <a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s m) => <a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s (<a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Writer-Strict.html#t:WriterT">WriterT</a> w m)</span></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s (<a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-State-Lazy.html#t:StateT">StateT</a> s m)</span></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s (<a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-State-Strict.html#t:StateT">StateT</a> s m)</span></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s m => <a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s (<a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> r m)</span></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s m => <a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s (<a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Except.html#t:ExceptT">ExceptT</a> e m)</span></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Error-Class.html#t:Error">Error</a> e, <a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s m) => <a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s (<a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Error.html#t:ErrorT">ErrorT</a> e m)</span></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s m => <a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s (<a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Cont.html#t:ContT">ContT</a> r m)</span></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> w) => <a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s (<a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m)</span></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> w) => <a href="Control-Monad-Representable-State.html#t:MonadState">MonadState</a> s (<a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-RWS-Strict.html#t:RWST">RWST</a> r w s m)</span></td><td class="doc empty"> </td></tr></table></div></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>
|