/usr/share/doc/libghc-comonad-doc/html/Control-Comonad-Trans-Env.html is in libghc-comonad-doc 4.0-1build3.
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 | <!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.Comonad.Trans.Env</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-Comonad-Trans-Env.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Control-Comonad-Trans-Env.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">comonad-4.0: Comonads</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>Edward Kmett <ekmett@gmail.com></td></tr><tr><th>Safe Haskell</th><td>Trustworthy</td></tr></table><p class="caption">Control.Comonad.Trans.Env</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">The strict environment comonad
</a></li><li><a href="#g:2">The strict environment comonad transformer
</a></li><li><a href="#g:3">Combinators
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>The environment comonad holds a value along with some retrievable context.
</p><p>This module specifies the environment comonad transformer (aka coreader),
which is left adjoint to the reader comonad.
</p><p>The following sets up an experiment that retains its initial value in the
background:
</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>let initial = env 0 0
</code></strong></pre><p>Extract simply retrieves the value:
</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>extract initial
</code></strong>0
</pre><p>Play around with the value, in our case producing a negative value:
</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>let experiment = fmap (+ 10) initial
</code></strong><code class="prompt">>>> </code><strong class="userinput"><code>extract experiment
</code></strong>10
</pre><p>Oh noes, something went wrong, 10 isn't very negative! Better restore the
initial value using the default:
</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>let initialRestored = experiment =>> ask
</code></strong><code class="prompt">>>> </code><strong class="userinput"><code>extract initialRestored
</code></strong>0
</pre></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:Env">Env</a> e = <a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e <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:env">env</a> :: e -> a -> <a href="Control-Comonad-Trans-Env.html#t:Env">Env</a> e a</li><li class="src short"><a href="#v:runEnv">runEnv</a> :: <a href="Control-Comonad-Trans-Env.html#t:Env">Env</a> e a -> (e, a)</li><li class="src short"><span class="keyword">data</span> <a href="#t:EnvT">EnvT</a> e w a = <a href="#v:EnvT">EnvT</a> e (w a)</li><li class="src short"><a href="#v:runEnvT">runEnvT</a> :: <a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e w a -> (e, w a)</li><li class="src short"><a href="#v:lowerEnvT">lowerEnvT</a> :: <a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e w a -> w a</li><li class="src short"><a href="#v:ask">ask</a> :: <a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e w a -> e</li><li class="src short"><a href="#v:asks">asks</a> :: (e -> f) -> <a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e w a -> f</li><li class="src short"><a href="#v:local">local</a> :: (e -> e') -> <a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e w a -> <a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e' w a</li></ul></div><div id="interface"><h1 id="g:1">The strict environment comonad
</h1><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:Env" class="def">Env</a> e = <a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e <a href="/usr/share/doc/libghc-transformers-doc/html/Data-Functor-Identity.html#t:Identity">Identity</a><a href="src/Control-Comonad-Trans-Env.html#Env" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:env" class="def">env</a> :: e -> a -> <a href="Control-Comonad-Trans-Env.html#t:Env">Env</a> e a<a href="src/Control-Comonad-Trans-Env.html#env" class="link">Source</a></p><div class="doc"><p>Create an Env using an environment and a value
</p></div></div><div class="top"><p class="src"><a name="v:runEnv" class="def">runEnv</a> :: <a href="Control-Comonad-Trans-Env.html#t:Env">Env</a> e a -> (e, a)<a href="src/Control-Comonad-Trans-Env.html#runEnv" class="link">Source</a></p></div><h1 id="g:2">The strict environment comonad transformer
</h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:EnvT" class="def">EnvT</a> e w a <a href="src/Control-Comonad-Trans-Env.html#EnvT" class="link">Source</a></p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:EnvT" class="def">EnvT</a> e (w a)</td><td class="doc empty"> </td></tr></table></div><div class="subs instances"><p id="control.i:EnvT" class="caption collapser" onclick="toggleSection('i:EnvT')">Instances</p><div id="section.i:EnvT" class="show"><table><tr><td class="src"><a href="Control-Comonad.html#t:Comonad">Comonad</a> w => <a href="Control-Comonad-Env-Class.html#t:ComonadEnv">ComonadEnv</a> e (<a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e w)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Comonad-Store-Class.html#t:ComonadStore">ComonadStore</a> s w => <a href="Control-Comonad-Store-Class.html#t:ComonadStore">ComonadStore</a> s (<a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e w)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Comonad-Traced-Class.html#t:ComonadTraced">ComonadTraced</a> m w => <a href="Control-Comonad-Traced-Class.html#t:ComonadTraced">ComonadTraced</a> m (<a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e w)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Comonad-Trans-Class.html#t:ComonadTrans">ComonadTrans</a> (<a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Comonad-Hoist-Class.html#t:ComonadHoist">ComonadHoist</a> (<a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Comonad.html#t:Functor">Functor</a> w => <a href="Control-Comonad.html#t:Functor">Functor</a> (<a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e w)</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-Typeable-Internal.html#t:Typeable">Typeable</a> s, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Typeable-Internal.html#t:Typeable1">Typeable1</a> w) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Typeable-Internal.html#t:Typeable1">Typeable1</a> (<a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> s w)</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-Foldable.html#t:Foldable">Foldable</a> w => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Foldable.html#t:Foldable">Foldable</a> (<a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e w)</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-Traversable.html#t:Traversable">Traversable</a> w => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Traversable.html#t:Traversable">Traversable</a> (<a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e w)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/libghc-semigroups-doc/html/Data-Semigroup.html#t:Semigroup">Semigroup</a> e, <a href="Control-Comonad.html#t:ComonadApply">ComonadApply</a> w) => <a href="Control-Comonad.html#t:ComonadApply">ComonadApply</a> (<a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e w)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Comonad.html#t:Comonad">Comonad</a> w => <a href="Control-Comonad.html#t:Comonad">Comonad</a> (<a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e w)</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-Data.html#t:Data">Data</a> e, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Typeable-Internal.html#t:Typeable1">Typeable1</a> w, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Data.html#t:Data">Data</a> (w a), <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Data.html#t:Data">Data</a> a) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Data.html#t:Data">Data</a> (<a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e w a)</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-Typeable-Internal.html#t:Typeable">Typeable</a> s, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Typeable-Internal.html#t:Typeable1">Typeable1</a> w, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Typeable-Internal.html#t:Typeable">Typeable</a> a) => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Typeable-Internal.html#t:Typeable">Typeable</a> (<a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> s w a)</td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:runEnvT" class="def">runEnvT</a> :: <a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e w a -> (e, w a)<a href="src/Control-Comonad-Trans-Env.html#runEnvT" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:lowerEnvT" class="def">lowerEnvT</a> :: <a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e w a -> w a<a href="src/Control-Comonad-Trans-Env.html#lowerEnvT" class="link">Source</a></p><div class="doc"><p>Gets rid of the environment. This differs from <code><a href="Control-Comonad.html#v:extract">extract</a></code> in that it will
not continue extracting the value from the contained comonad.
</p></div></div><h1 id="g:3">Combinators
</h1><div class="top"><p class="src"><a name="v:ask" class="def">ask</a> :: <a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e w a -> e<a href="src/Control-Comonad-Trans-Env.html#ask" class="link">Source</a></p><div class="doc"><p>Retrieves the environment.
</p></div></div><div class="top"><p class="src"><a name="v:asks" class="def">asks</a> :: (e -> f) -> <a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e w a -> f<a href="src/Control-Comonad-Trans-Env.html#asks" class="link">Source</a></p><div class="doc"><p>Like <code><a href="Control-Comonad-Trans-Env.html#v:ask">ask</a></code>, but modifies the resulting value with a function.
</p><pre> asks = f . ask
</pre></div></div><div class="top"><p class="src"><a name="v:local" class="def">local</a> :: (e -> e') -> <a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e w a -> <a href="Control-Comonad-Trans-Env.html#t:EnvT">EnvT</a> e' w a<a href="src/Control-Comonad-Trans-Env.html#local" class="link">Source</a></p><div class="doc"><p>Modifies the environment using the specified function.
</p></div></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>
|