/usr/share/doc/libghc-monads-tf-doc/html/Control-Monad-RWS-Lazy.html is in libghc-monads-tf-doc 0.1.0.2-1.
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 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | <!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.RWS.Lazy</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-RWS-Lazy.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Control-Monad-RWS-Lazy.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">monads-tf-0.1.0.2: Monad classes, using type families</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>non-portable (type families)</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Maintainer</th><td>ross@soi.city.ac.uk</td></tr><tr><th>Safe Haskell</th><td>Safe-Inferred</td></tr></table><p class="caption">Control.Monad.RWS.Lazy</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">The RWS monad
</a></li><li><a href="#g:2">The RWST monad transformer
</a></li><li><a href="#g:3">Lazy Reader-writer-state monads
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Lazy RWS monad.
</p><p>Inspired by the paper
/Functional Programming with Overloading and
Higher-Order Polymorphism/,
Mark P Jones (<a href="http://web.cecs.pdx.edu/~mpj/">http://web.cecs.pdx.edu/~mpj/</a>)
Advanced School of Functional Programming, 1995.
</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:RWS">RWS</a> r w s = <a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s <a href="/usr/share/doc/libghc-transformers-doc/html/Data-Functor-Identity.html#t:Identity">Identity</a></li><li class="src short"><a href="#v:runRWS">runRWS</a> :: <a href="Control-Monad-RWS-Lazy.html#t:RWS">RWS</a> r w s a -> r -> s -> (a, s, w)</li><li class="src short"><a href="#v:evalRWS">evalRWS</a> :: <a href="Control-Monad-RWS-Lazy.html#t:RWS">RWS</a> r w s a -> r -> s -> (a, w)</li><li class="src short"><a href="#v:execRWS">execRWS</a> :: <a href="Control-Monad-RWS-Lazy.html#t:RWS">RWS</a> r w s a -> r -> s -> (s, w)</li><li class="src short"><a href="#v:mapRWS">mapRWS</a> :: ((a, s, w) -> (b, s, w')) -> <a href="Control-Monad-RWS-Lazy.html#t:RWS">RWS</a> r w s a -> <a href="Control-Monad-RWS-Lazy.html#t:RWS">RWS</a> r w' s b</li><li class="src short"><a href="#v:withRWS">withRWS</a> :: (r' -> s -> (r, s)) -> <a href="Control-Monad-RWS-Lazy.html#t:RWS">RWS</a> r w s a -> <a href="Control-Monad-RWS-Lazy.html#t:RWS">RWS</a> r' w s a</li><li class="src short"><span class="keyword">newtype</span> <a href="#t:RWST">RWST</a> r w s m a = <a href="#v:RWST">RWST</a> {<ul class="subs"><li><a href="#v:runRWST">runRWST</a> :: r -> s -> m (a, s, w)</li></ul>}</li><li class="src short"><a href="#v:evalRWST">evalRWST</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a> m => <a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m a -> r -> s -> m (a, w)</li><li class="src short"><a href="#v:execRWST">execRWST</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a> m => <a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m a -> r -> s -> m (s, w)</li><li class="src short"><a href="#v:mapRWST">mapRWST</a> :: (m (a, s, w) -> n (b, s, w')) -> <a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m a -> <a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w' s n b</li><li class="src short"><a href="#v:withRWST">withRWST</a> :: (r' -> s -> (r, s)) -> <a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m a -> <a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r' w s m a</li><li class="src short">module <a href="Control-Monad-RWS-Class.html">Control.Monad.RWS.Class</a></li><li class="src short">module <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html">Control.Monad</a></li><li class="src short">module <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-Fix.html">Control.Monad.Fix</a></li><li class="src short">module <a href="Control-Monad-Trans.html">Control.Monad.Trans</a></li><li class="src short">module <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Monoid.html">Data.Monoid</a></li></ul></div><div id="interface"><h1 id="g:1">The RWS monad
</h1><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:RWS" class="def">RWS</a> r w s = <a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s <a href="/usr/share/doc/libghc-transformers-doc/html/Data-Functor-Identity.html#t:Identity">Identity</a></p><div class="doc"><p>A monad containing an environment of type <code>r</code>, output of type <code>w</code>
and an updatable state of type <code>s</code>.
</p></div></div><div class="top"><p class="src"><a name="v:runRWS" class="def">runRWS</a> :: <a href="Control-Monad-RWS-Lazy.html#t:RWS">RWS</a> r w s a -> r -> s -> (a, s, w)</p><div class="doc"><p>Unwrap an RWS computation as a function.
(The inverse of <code><a href="/usr/share/doc/libghc-transformers-doc/html/Control-Monad-Trans-RWS-Lazy.html#v:rws">rws</a></code>.)
</p></div></div><div class="top"><p class="src"><a name="v:evalRWS" class="def">evalRWS</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Control-Monad-RWS-Lazy.html#t:RWS">RWS</a> r w s a</td><td class="doc"><p>RWS computation to execute
</p></td></tr><tr><td class="src">-> r</td><td class="doc"><p>initial environment
</p></td></tr><tr><td class="src">-> s</td><td class="doc"><p>initial value
</p></td></tr><tr><td class="src">-> (a, w)</td><td class="doc"><p>final value and output
</p></td></tr></table></div><div class="doc"><p>Evaluate a computation with the given initial state and environment,
returning the final value and output, discarding the final state.
</p></div></div><div class="top"><p class="src"><a name="v:execRWS" class="def">execRWS</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Control-Monad-RWS-Lazy.html#t:RWS">RWS</a> r w s a</td><td class="doc"><p>RWS computation to execute
</p></td></tr><tr><td class="src">-> r</td><td class="doc"><p>initial environment
</p></td></tr><tr><td class="src">-> s</td><td class="doc"><p>initial value
</p></td></tr><tr><td class="src">-> (s, w)</td><td class="doc"><p>final state and output
</p></td></tr></table></div><div class="doc"><p>Evaluate a computation with the given initial state and environment,
returning the final state and output, discarding the final value.
</p></div></div><div class="top"><p class="src"><a name="v:mapRWS" class="def">mapRWS</a> :: ((a, s, w) -> (b, s, w')) -> <a href="Control-Monad-RWS-Lazy.html#t:RWS">RWS</a> r w s a -> <a href="Control-Monad-RWS-Lazy.html#t:RWS">RWS</a> r w' s b</p><div class="doc"><p>Map the return value, final state and output of a computation using
the given function.
</p><ul><li><pre><code><a href="Control-Monad-RWS-Lazy.html#v:runRWS">runRWS</a></code> (<code><a href="Control-Monad-RWS-Lazy.html#v:mapRWS">mapRWS</a></code> f m) r s = f (<code><a href="Control-Monad-RWS-Lazy.html#v:runRWS">runRWS</a></code> m r s)</pre></li></ul></div></div><div class="top"><p class="src"><a name="v:withRWS" class="def">withRWS</a> :: (r' -> s -> (r, s)) -> <a href="Control-Monad-RWS-Lazy.html#t:RWS">RWS</a> r w s a -> <a href="Control-Monad-RWS-Lazy.html#t:RWS">RWS</a> r' w s a</p><div class="doc"><p><code><code><a href="Control-Monad-RWS-Lazy.html#v:withRWS">withRWS</a></code> f m</code> executes action <code>m</code> with an initial environment
and state modified by applying <code>f</code>.
</p><ul><li><pre><code><a href="Control-Monad-RWS-Lazy.html#v:runRWS">runRWS</a></code> (<code><a href="Control-Monad-RWS-Lazy.html#v:withRWS">withRWS</a></code> f m) r s = <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Tuple.html#v:uncurry">uncurry</a></code> (<code><a href="Control-Monad-RWS-Lazy.html#v:runRWS">runRWS</a></code> m) (f r s)</pre></li></ul></div></div><h1 id="g:2">The RWST monad transformer
</h1><div class="top"><p class="src"><span class="keyword">newtype</span> <a name="t:RWST" class="def">RWST</a> r w s m a </p><div class="doc"><p>A monad transformer adding reading an environment of type <code>r</code>,
collecting an output of type <code>w</code> and updating a state of type <code>s</code>
to an inner monad <code>m</code>.
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:RWST" class="def">RWST</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:runRWST" class="def">runRWST</a> :: r -> s -> m (a, s, w)</dt><dd class="doc empty"> </dd></dl><div class="clear"></div></div></td></tr></table></div><div class="subs instances"><p id="control.i:RWST" class="caption collapser" onclick="toggleSection('i:RWST')">Instances</p><div id="section.i:RWST" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Monoid.html#t:Monoid">Monoid</a> w => <a href="/usr/share/doc/libghc-transformers-doc/html/Control-Monad-Trans-Class.html#t:MonadTrans">MonadTrans</a> (<a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Monoid.html#t:Monoid">Monoid</a> w, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a> (<a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Functor">Functor</a> m => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Functor">Functor</a> (<a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Monoid.html#t:Monoid">Monoid</a> w, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-Fix.html#t:MonadFix">MonadFix</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-Fix.html#t:MonadFix">MonadFix</a> (<a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Monoid.html#t:Monoid">Monoid</a> w, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:MonadPlus">MonadPlus</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:MonadPlus">MonadPlus</a> (<a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Monoid.html#t:Monoid">Monoid</a> w, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Applicative.html#t:Applicative">Applicative</a> (<a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Monoid.html#t:Monoid">Monoid</a> w, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Functor">Functor</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:MonadPlus">MonadPlus</a> m) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Applicative.html#t:Alternative">Alternative</a> (<a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Monoid.html#t:Monoid">Monoid</a> w, <a href="/usr/share/doc/libghc-transformers-doc/html/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m) => <a href="/usr/share/doc/libghc-transformers-doc/html/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> (<a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Monoid.html#t:Monoid">Monoid</a> w, <a href="Control-Monad-Cont-Class.html#t:MonadCont">MonadCont</a> m) => <a href="Control-Monad-Cont-Class.html#t:MonadCont">MonadCont</a> (<a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Monoid.html#t:Monoid">Monoid</a> w, <a href="Control-Monad-Error-Class.html#t:MonadError">MonadError</a> m) => <a href="Control-Monad-Error-Class.html#t:MonadError">MonadError</a> (<a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Monoid.html#t:Monoid">Monoid</a> w, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a> m) => <a href="Control-Monad-Reader-Class.html#t:MonadReader">MonadReader</a> (<a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Monoid.html#t:Monoid">Monoid</a> w) => <a href="Control-Monad-State-Class.html#t:MonadState">MonadState</a> (<a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Monoid.html#t:Monoid">Monoid</a> w, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a> m) => <a href="Control-Monad-Writer-Class.html#t:MonadWriter">MonadWriter</a> (<a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Monoid.html#t:Monoid">Monoid</a> w, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a> m) => <a href="Control-Monad-RWS-Class.html#t:MonadRWS">MonadRWS</a> (<a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m)</td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:evalRWST" class="def">evalRWST</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a> m</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m a</td><td class="doc"><p>computation to execute
</p></td></tr><tr><td class="src">-> r</td><td class="doc"><p>initial environment
</p></td></tr><tr><td class="src">-> s</td><td class="doc"><p>initial value
</p></td></tr><tr><td class="src">-> m (a, w)</td><td class="doc"><p>computation yielding final value and output
</p></td></tr></table></div><div class="doc"><p>Evaluate a computation with the given initial state and environment,
returning the final value and output, discarding the final state.
</p></div></div><div class="top"><p class="src"><a name="v:execRWST" class="def">execRWST</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a> m</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m a</td><td class="doc"><p>computation to execute
</p></td></tr><tr><td class="src">-> r</td><td class="doc"><p>initial environment
</p></td></tr><tr><td class="src">-> s</td><td class="doc"><p>initial value
</p></td></tr><tr><td class="src">-> m (s, w)</td><td class="doc"><p>computation yielding final state and output
</p></td></tr></table></div><div class="doc"><p>Evaluate a computation with the given initial state and environment,
returning the final state and output, discarding the final value.
</p></div></div><div class="top"><p class="src"><a name="v:mapRWST" class="def">mapRWST</a> :: (m (a, s, w) -> n (b, s, w')) -> <a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m a -> <a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w' s n b</p><div class="doc"><p>Map the inner computation using the given function.
</p><ul><li><pre><code><a href="Control-Monad-RWS-Lazy.html#v:runRWST">runRWST</a></code> (<code><a href="Control-Monad-RWS-Lazy.html#v:mapRWST">mapRWST</a></code> f m) r s = f (<code><a href="Control-Monad-RWS-Lazy.html#v:runRWST">runRWST</a></code> m r s)</pre></li></ul></div></div><div class="top"><p class="src"><a name="v:withRWST" class="def">withRWST</a> :: (r' -> s -> (r, s)) -> <a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r w s m a -> <a href="Control-Monad-RWS-Lazy.html#t:RWST">RWST</a> r' w s m a</p><div class="doc"><p><code><code><a href="Control-Monad-RWS-Lazy.html#v:withRWST">withRWST</a></code> f m</code> executes action <code>m</code> with an initial environment
and state modified by applying <code>f</code>.
</p><ul><li><pre><code><a href="Control-Monad-RWS-Lazy.html#v:runRWST">runRWST</a></code> (<code><a href="Control-Monad-RWS-Lazy.html#v:withRWST">withRWST</a></code> f m) r s = <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Tuple.html#v:uncurry">uncurry</a></code> (<code><a href="Control-Monad-RWS-Lazy.html#v:runRWST">runRWST</a></code> m) (f r s)</pre></li></ul></div></div><h1 id="g:3">Lazy Reader-writer-state monads
</h1><div class="top"><p class="src">module <a href="Control-Monad-RWS-Class.html">Control.Monad.RWS.Class</a></p></div><div class="top"><p class="src">module <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html">Control.Monad</a></p></div><div class="top"><p class="src">module <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-Fix.html">Control.Monad.Fix</a></p></div><div class="top"><p class="src">module <a href="Control-Monad-Trans.html">Control.Monad.Trans</a></p></div><div class="top"><p class="src">module <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Monoid.html">Data.Monoid</a></p></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.13.2</p></div></body></html>
|