/usr/share/doc/libghc-lens-doc/html/Control-Lens-Review.html is in libghc-lens-doc 4.1.2.1-3.
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | <!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.Lens.Review</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-Lens-Review.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Control-Lens-Review.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">lens-4.1.2.1: Lenses, Folds and Traversals</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>non-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.Lens.Review</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Reviewing
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>A <code><a href="Control-Lens-Review.html#t:Review">Review</a></code> is a type-restricted form of a <code><a href="Control-Lens-Type.html#t:Prism">Prism</a></code> that can only be used for
writing back via <code><a href="Control-Lens-Review.html#v:re">re</a></code>, <code><a href="Control-Lens-Review.html#v:review">review</a></code>, <code><a href="Control-Lens-Review.html#v:reuse">reuse</a></code>.
</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:Review">Review</a> s t a b = <span class="keyword">forall</span> p f. (<a href="Control-Lens-Iso.html#t:Profunctor">Profunctor</a> p, <a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a> p, <a href="Control-Lens-Internal-Setter.html#t:Settable">Settable</a> f) => <a href="Control-Lens-Type.html#t:Optic">Optic</a> p f s t a b</li><li class="src short"><span class="keyword">type</span> <a href="#t:Review-39-">Review'</a> t b = <a href="Control-Lens-Review.html#t:Review">Review</a> t t b b</li><li class="src short"><span class="keyword">type</span> <a href="#t:AReview">AReview</a> s t a b = <a href="Control-Lens-Type.html#t:Optic">Optic</a> <a href="/usr/share/doc/libghc-tagged-doc/html/Data-Tagged.html#t:Tagged">Tagged</a> <a href="Control-Lens-Setter.html#t:Identity">Identity</a> s t a b</li><li class="src short"><span class="keyword">type</span> <a href="#t:AReview-39-">AReview'</a> t b = <a href="Control-Lens-Review.html#t:AReview">AReview</a> t t b b</li><li class="src short"><a href="#v:unto">unto</a> :: (<a href="Control-Lens-Iso.html#t:Profunctor">Profunctor</a> p, <a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a> p, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Functor">Functor</a> f) => (b -> t) -> <a href="Control-Lens-Type.html#t:Optic">Optic</a> p f s t a b</li><li class="src short"><a href="#v:un">un</a> :: (<a href="Control-Lens-Iso.html#t:Profunctor">Profunctor</a> p, <a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a> p, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Functor">Functor</a> f) => <a href="Control-Lens-Getter.html#t:Getting">Getting</a> a s a -> <a href="Control-Lens-Type.html#t:Optic-39-">Optic'</a> p f a s</li><li class="src short"><a href="#v:re">re</a> :: <a href="Control-Lens-Review.html#t:AReview">AReview</a> s t a b -> <a href="Control-Lens-Type.html#t:Getter">Getter</a> b t</li><li class="src short"><a href="#v:review">review</a> :: <a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader-Class.html#t:MonadReader">MonadReader</a> b m => <a href="Control-Lens-Review.html#t:AReview">AReview</a> s t a b -> m t</li><li class="src short"><a href="#v:reviews">reviews</a> :: <a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader-Class.html#t:MonadReader">MonadReader</a> b m => <a href="Control-Lens-Review.html#t:AReview">AReview</a> s t a b -> (t -> r) -> m r</li><li class="src short"><a href="#v:reuse">reuse</a> :: <a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-State-Class.html#t:MonadState">MonadState</a> b m => <a href="Control-Lens-Review.html#t:AReview">AReview</a> s t a b -> m t</li><li class="src short"><a href="#v:reuses">reuses</a> :: <a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-State-Class.html#t:MonadState">MonadState</a> b m => <a href="Control-Lens-Review.html#t:AReview">AReview</a> s t a b -> (t -> r) -> m r</li><li class="src short"><a href="#v:-35-">(#)</a> :: <a href="Control-Lens-Review.html#t:AReview">AReview</a> s t a b -> b -> t</li><li class="src short"><span class="keyword">class</span> <a href="#t:Bifunctor">Bifunctor</a> p <span class="keyword">where</span><ul class="subs"><li><a href="#v:bimap">bimap</a> :: (a -> b) -> (c -> d) -> p a c -> p b d</li></ul></li><li class="src short"><a href="#v:retagged">retagged</a> :: (<a href="Control-Lens-Iso.html#t:Profunctor">Profunctor</a> p, <a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a> p) => p a b -> p s b</li><li class="src short"><span class="keyword">class</span> (<a href="Control-Lens-Iso.html#t:Profunctor">Profunctor</a> p, <a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a> p) => <a href="#t:Reviewable">Reviewable</a> p </li></ul></div><div id="interface"><h1 id="g:1">Reviewing
</h1><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:Review" class="def">Review</a> s t a b = <span class="keyword">forall</span> p f. (<a href="Control-Lens-Iso.html#t:Profunctor">Profunctor</a> p, <a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a> p, <a href="Control-Lens-Internal-Setter.html#t:Settable">Settable</a> f) => <a href="Control-Lens-Type.html#t:Optic">Optic</a> p f s t a b<a href="src/Control-Lens-Review.html#Review" class="link">Source</a></p><div class="doc"><p>This is a limited form of a <code><a href="Control-Lens-Type.html#t:Prism">Prism</a></code> that can only be used for <code><a href="Control-Lens-Review.html#v:re">re</a></code> operations.
</p><p>Like with a <code><a href="Control-Lens-Type.html#t:Getter">Getter</a></code>, there are no laws to state for a <code><a href="Control-Lens-Review.html#t:Review">Review</a></code>.
</p><p>You can generate a <code><a href="Control-Lens-Review.html#t:Review">Review</a></code> by using <code><a href="Control-Lens-Review.html#v:unto">unto</a></code>. You can also use any <code><a href="Control-Lens-Type.html#t:Prism">Prism</a></code> or <code><a href="Control-Lens-Type.html#t:Iso">Iso</a></code>
directly as a <code><a href="Control-Lens-Review.html#t:Review">Review</a></code>.
</p></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:Review-39-" class="def">Review'</a> t b = <a href="Control-Lens-Review.html#t:Review">Review</a> t t b b<a href="src/Control-Lens-Review.html#Review%27" class="link">Source</a></p><div class="doc"><p>A <code><a href="Control-Lens-Type.html#t:Simple">Simple</a></code> <code><a href="Control-Lens-Review.html#t:Review">Review</a></code>
</p></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:AReview" class="def">AReview</a> s t a b = <a href="Control-Lens-Type.html#t:Optic">Optic</a> <a href="/usr/share/doc/libghc-tagged-doc/html/Data-Tagged.html#t:Tagged">Tagged</a> <a href="Control-Lens-Setter.html#t:Identity">Identity</a> s t a b<a href="src/Control-Lens-Review.html#AReview" class="link">Source</a></p><div class="doc"><p>If you see this in a signature for a function, the function is expecting a <code><a href="Control-Lens-Review.html#t:Review">Review</a></code>
(in practice, this usually means a <code><a href="Control-Lens-Type.html#t:Prism">Prism</a></code>).
</p></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:AReview-39-" class="def">AReview'</a> t b = <a href="Control-Lens-Review.html#t:AReview">AReview</a> t t b b<a href="src/Control-Lens-Review.html#AReview%27" class="link">Source</a></p><div class="doc"><p>A <code><a href="Control-Lens-Type.html#t:Simple">Simple</a></code> <code><a href="Control-Lens-Review.html#t:AReview">AReview</a></code>
</p></div></div><div class="top"><p class="src"><a name="v:unto" class="def">unto</a> :: (<a href="Control-Lens-Iso.html#t:Profunctor">Profunctor</a> p, <a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a> p, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Functor">Functor</a> f) => (b -> t) -> <a href="Control-Lens-Type.html#t:Optic">Optic</a> p f s t a b<a href="src/Control-Lens-Review.html#unto" class="link">Source</a></p><div class="doc"><p>An analogue of <code><a href="Control-Lens-Getter.html#v:to">to</a></code> for <code><a href="Control-Lens-Review.html#v:review">review</a></code>.
</p><pre>
<code><a href="Control-Lens-Review.html#v:unto">unto</a></code> :: (b -> t) -> <code><a href="Control-Lens-Review.html#t:Review-39-">Review'</a></code> t b
</pre><pre>
<code><a href="Control-Lens-Review.html#v:unto">unto</a></code> = <code><a href="Control-Lens-Review.html#v:un">un</a></code> . <code><a href="Control-Lens-Getter.html#v:to">to</a></code>
</pre></div></div><div class="top"><p class="src"><a name="v:un" class="def">un</a> :: (<a href="Control-Lens-Iso.html#t:Profunctor">Profunctor</a> p, <a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a> p, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Functor">Functor</a> f) => <a href="Control-Lens-Getter.html#t:Getting">Getting</a> a s a -> <a href="Control-Lens-Type.html#t:Optic-39-">Optic'</a> p f a s<a href="src/Control-Lens-Review.html#un" class="link">Source</a></p><div class="doc"><p>Turn a <code><a href="Control-Lens-Type.html#t:Getter">Getter</a></code> around to get a <code><a href="Control-Lens-Review.html#t:Review">Review</a></code>
</p><pre>
<code><a href="Control-Lens-Review.html#v:un">un</a></code> = <code><a href="Control-Lens-Review.html#v:unto">unto</a></code> . <code><a href="Control-Lens-Getter.html#v:view">view</a></code>
<code><a href="Control-Lens-Review.html#v:unto">unto</a></code> = <code><a href="Control-Lens-Review.html#v:un">un</a></code> . <code><a href="Control-Lens-Getter.html#v:to">to</a></code>
</pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>un (to length) # [1,2,3]
</code></strong>3
</pre></div></div><div class="top"><p class="src"><a name="v:re" class="def">re</a> :: <a href="Control-Lens-Review.html#t:AReview">AReview</a> s t a b -> <a href="Control-Lens-Type.html#t:Getter">Getter</a> b t<a href="src/Control-Lens-Review.html#re" class="link">Source</a></p><div class="doc"><p>Turn a <code><a href="Control-Lens-Type.html#t:Prism">Prism</a></code> or <code><a href="Control-Lens-Iso.html#t:Iso">Iso</a></code> around to build a <code><a href="Control-Lens-Type.html#t:Getter">Getter</a></code>.
</p><p>If you have an <code><a href="Control-Lens-Iso.html#t:Iso">Iso</a></code>, <code><a href="Control-Lens-Iso.html#t:from">from</a></code> is a more powerful version of this function
that will return an <code><a href="Control-Lens-Iso.html#t:Iso">Iso</a></code> instead of a mere <code><a href="Control-Lens-Type.html#t:Getter">Getter</a></code>.
</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>5 ^.re _Left
</code></strong>Left 5
</pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>6 ^.re (_Left.unto succ)
</code></strong>Left 7
</pre><pre>
<code><a href="Control-Lens-Review.html#v:review">review</a></code> ≡ <code><a href="Control-Lens-Getter.html#v:view">view</a></code> <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:.">.</a></code> <code><a href="Control-Lens-Review.html#v:re">re</a></code>
<code><a href="Control-Lens-Review.html#v:reviews">reviews</a></code> ≡ <code><a href="Control-Lens-Getter.html#v:views">views</a></code> <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:.">.</a></code> <code><a href="Control-Lens-Review.html#v:re">re</a></code>
<code><a href="Control-Lens-Review.html#v:reuse">reuse</a></code> ≡ <code><a href="Control-Lens-Getter.html#v:use">use</a></code> <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:.">.</a></code> <code><a href="Control-Lens-Review.html#v:re">re</a></code>
<code><a href="Control-Lens-Review.html#v:reuses">reuses</a></code> ≡ <code><a href="Control-Lens-Getter.html#v:uses">uses</a></code> <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:.">.</a></code> <code><a href="Control-Lens-Review.html#v:re">re</a></code>
</pre><pre>
<code><a href="Control-Lens-Review.html#v:re">re</a></code> :: <code><a href="Control-Lens-Type.html#t:Prism">Prism</a></code> s t a b -> <code><a href="Control-Lens-Type.html#t:Getter">Getter</a></code> b t
<code><a href="Control-Lens-Review.html#v:re">re</a></code> :: <code><a href="Control-Lens-Type.html#t:Iso">Iso</a></code> s t a b -> <code><a href="Control-Lens-Type.html#t:Getter">Getter</a></code> b t
</pre></div></div><div class="top"><p class="src"><a name="v:review" class="def">review</a> :: <a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader-Class.html#t:MonadReader">MonadReader</a> b m => <a href="Control-Lens-Review.html#t:AReview">AReview</a> s t a b -> m t<a href="src/Control-Lens-Review.html#review" class="link">Source</a></p><div class="doc"><p>This can be used to turn an <code><a href="Control-Lens-Iso.html#t:Iso">Iso</a></code> or <code><a href="Control-Lens-Type.html#t:Prism">Prism</a></code> around and <code><a href="Control-Lens-Getter.html#v:view">view</a></code> a value (or the current environment) through it the other way.
</p><pre>
<code><a href="Control-Lens-Review.html#v:review">review</a></code> ≡ <code><a href="Control-Lens-Getter.html#v:view">view</a></code> <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:.">.</a></code> <code><a href="Control-Lens-Review.html#v:re">re</a></code>
<code><a href="Control-Lens-Review.html#v:review">review</a></code> . <code><a href="Control-Lens-Review.html#v:unto">unto</a></code> ≡ <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:id">id</a></code>
</pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>review _Left "mustard"
</code></strong>Left "mustard"
</pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>review (unto succ) 5
</code></strong>6
</pre><p>Usually <code><a href="Control-Lens-Review.html#v:review">review</a></code> is used in the <code>(->)</code> <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a></code> with a <code><a href="Control-Lens-Type.html#t:Prism">Prism</a></code> or <code><a href="Control-Lens-Iso.html#t:Iso">Iso</a></code>, in which case it may be useful to think of
it as having one of these more restricted type signatures:
</p><pre>
<code><a href="Control-Lens-Review.html#v:review">review</a></code> :: <code><a href="Control-Lens-Type.html#t:Iso-39-">Iso'</a></code> s a -> a -> s
<code><a href="Control-Lens-Review.html#v:review">review</a></code> :: <code><a href="Control-Lens-Type.html#t:Prism-39-">Prism'</a></code> s a -> a -> s
</pre><p>However, when working with a <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a></code> transformer stack, it is sometimes useful to be able to <code><a href="Control-Lens-Review.html#v:review">review</a></code> the current environment, in which case one of
these more slightly more liberal type signatures may be beneficial to think of it as having:
</p><pre>
<code><a href="Control-Lens-Review.html#v:review">review</a></code> :: <code><a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader-Class.html#t:MonadReader">MonadReader</a></code> a m => <code><a href="Control-Lens-Type.html#t:Iso-39-">Iso'</a></code> s a -> m s
<code><a href="Control-Lens-Review.html#v:review">review</a></code> :: <code><a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader-Class.html#t:MonadReader">MonadReader</a></code> a m => <code><a href="Control-Lens-Type.html#t:Prism-39-">Prism'</a></code> s a -> m s
</pre></div></div><div class="top"><p class="src"><a name="v:reviews" class="def">reviews</a> :: <a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader-Class.html#t:MonadReader">MonadReader</a> b m => <a href="Control-Lens-Review.html#t:AReview">AReview</a> s t a b -> (t -> r) -> m r<a href="src/Control-Lens-Review.html#reviews" class="link">Source</a></p><div class="doc"><p>This can be used to turn an <code><a href="Control-Lens-Iso.html#t:Iso">Iso</a></code> or <code><a href="Control-Lens-Type.html#t:Prism">Prism</a></code> around and <code><a href="Control-Lens-Getter.html#v:view">view</a></code> a value (or the current environment) through it the other way,
applying a function.
</p><pre>
<code><a href="Control-Lens-Review.html#v:reviews">reviews</a></code> ≡ <code><a href="Control-Lens-Getter.html#v:views">views</a></code> <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:.">.</a></code> <code><a href="Control-Lens-Review.html#v:re">re</a></code>
<code><a href="Control-Lens-Review.html#v:reviews">reviews</a></code> (<code><a href="Control-Lens-Review.html#v:unto">unto</a></code> f) g ≡ g <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:.">.</a></code> f
</pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>reviews _Left isRight "mustard"
</code></strong>False
</pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>reviews (unto succ) (*2) 3
</code></strong>8
</pre><p>Usually this function is used in the <code>(->)</code> <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a></code> with a <code><a href="Control-Lens-Type.html#t:Prism">Prism</a></code> or <code><a href="Control-Lens-Iso.html#t:Iso">Iso</a></code>, in which case it may be useful to think of
it as having one of these more restricted type signatures:
</p><pre>
<code><a href="Control-Lens-Review.html#v:reviews">reviews</a></code> :: <code><a href="Control-Lens-Type.html#t:Iso-39-">Iso'</a></code> s a -> (s -> r) -> a -> r
<code><a href="Control-Lens-Review.html#v:reviews">reviews</a></code> :: <code><a href="Control-Lens-Type.html#t:Prism-39-">Prism'</a></code> s a -> (s -> r) -> a -> r
</pre><p>However, when working with a <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a></code> transformer stack, it is sometimes useful to be able to <code><a href="Control-Lens-Review.html#v:review">review</a></code> the current environment, in which case one of
these more slightly more liberal type signatures may be beneficial to think of it as having:
</p><pre>
<code><a href="Control-Lens-Review.html#v:reviews">reviews</a></code> :: <code><a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader-Class.html#t:MonadReader">MonadReader</a></code> a m => <code><a href="Control-Lens-Type.html#t:Iso-39-">Iso'</a></code> s a -> (s -> r) -> m r
<code><a href="Control-Lens-Review.html#v:reviews">reviews</a></code> :: <code><a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader-Class.html#t:MonadReader">MonadReader</a></code> a m => <code><a href="Control-Lens-Type.html#t:Prism-39-">Prism'</a></code> s a -> (s -> r) -> m r
</pre></div></div><div class="top"><p class="src"><a name="v:reuse" class="def">reuse</a> :: <a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-State-Class.html#t:MonadState">MonadState</a> b m => <a href="Control-Lens-Review.html#t:AReview">AReview</a> s t a b -> m t<a href="src/Control-Lens-Review.html#reuse" class="link">Source</a></p><div class="doc"><p>This can be used to turn an <code><a href="Control-Lens-Iso.html#t:Iso">Iso</a></code> or <code><a href="Control-Lens-Type.html#t:Prism">Prism</a></code> around and <code><a href="Control-Lens-Getter.html#v:use">use</a></code> a value (or the current environment) through it the other way.
</p><pre>
<code><a href="Control-Lens-Review.html#v:reuse">reuse</a></code> ≡ <code><a href="Control-Lens-Getter.html#v:use">use</a></code> <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:.">.</a></code> <code><a href="Control-Lens-Review.html#v:re">re</a></code>
<code><a href="Control-Lens-Review.html#v:reuse">reuse</a></code> <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:.">.</a></code> <code><a href="Control-Lens-Review.html#v:unto">unto</a></code> ≡ <code><a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-State-Class.html#v:gets">gets</a></code>
</pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>evalState (reuse _Left) 5
</code></strong>Left 5
</pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>evalState (reuse (unto succ)) 5
</code></strong>6
</pre><pre>
<code><a href="Control-Lens-Review.html#v:reuse">reuse</a></code> :: <code><a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-State-Class.html#t:MonadState">MonadState</a></code> a m => <code><a href="Control-Lens-Type.html#t:Prism-39-">Prism'</a></code> s a -> m s
<code><a href="Control-Lens-Review.html#v:reuse">reuse</a></code> :: <code><a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-State-Class.html#t:MonadState">MonadState</a></code> a m => <code><a href="Control-Lens-Type.html#t:Iso-39-">Iso'</a></code> s a -> m s
</pre></div></div><div class="top"><p class="src"><a name="v:reuses" class="def">reuses</a> :: <a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-State-Class.html#t:MonadState">MonadState</a> b m => <a href="Control-Lens-Review.html#t:AReview">AReview</a> s t a b -> (t -> r) -> m r<a href="src/Control-Lens-Review.html#reuses" class="link">Source</a></p><div class="doc"><p>This can be used to turn an <code><a href="Control-Lens-Iso.html#t:Iso">Iso</a></code> or <code><a href="Control-Lens-Type.html#t:Prism">Prism</a></code> around and <code><a href="Control-Lens-Getter.html#v:use">use</a></code> the current state through it the other way,
applying a function.
</p><pre>
<code><a href="Control-Lens-Review.html#v:reuses">reuses</a></code> ≡ <code><a href="Control-Lens-Getter.html#v:uses">uses</a></code> <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:.">.</a></code> <code><a href="Control-Lens-Review.html#v:re">re</a></code>
<code><a href="Control-Lens-Review.html#v:reuses">reuses</a></code> (<code><a href="Control-Lens-Review.html#v:unto">unto</a></code> f) g ≡ <code><a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-State-Class.html#v:gets">gets</a></code> (g <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:.">.</a></code> f)
</pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>evalState (reuses _Left isLeft) (5 :: Int)
</code></strong>True
</pre><pre>
<code><a href="Control-Lens-Review.html#v:reuses">reuses</a></code> :: <code><a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-State-Class.html#t:MonadState">MonadState</a></code> a m => <code><a href="Control-Lens-Type.html#t:Prism-39-">Prism'</a></code> s a -> (s -> r) -> m r
<code><a href="Control-Lens-Review.html#v:reuses">reuses</a></code> :: <code><a href="/usr/share/doc/libghc-mtl-doc/html/Control-Monad-State-Class.html#t:MonadState">MonadState</a></code> a m => <code><a href="Control-Lens-Type.html#t:Iso-39-">Iso'</a></code> s a -> (s -> r) -> m r
</pre></div></div><div class="top"><p class="src"><a name="v:-35-" class="def">(#)</a> :: <a href="Control-Lens-Review.html#t:AReview">AReview</a> s t a b -> b -> t<a href="src/Control-Lens-Review.html#%23" class="link">Source</a></p><div class="doc"><p>An infix alias for <code><a href="Control-Lens-Review.html#v:review">review</a></code>.
</p><pre>
<code><a href="Control-Lens-Review.html#v:unto">unto</a></code> f # x ≡ f x
l # x ≡ x <code><a href="Control-Lens-Getter.html#v:-94-.">^.</a></code> <code><a href="Control-Lens-Review.html#v:re">re</a></code> l
</pre><p>This is commonly used when using a <code><a href="Control-Lens-Type.html#t:Prism">Prism</a></code> as a smart constructor.
</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>_Left # 4
</code></strong>Left 4
</pre><p>But it can be used for any <code><a href="Control-Lens-Type.html#t:Prism">Prism</a></code>
</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>base 16 # 123
</code></strong>"7b"
</pre><pre>
(#) :: <code><a href="Control-Lens-Type.html#t:Iso-39-">Iso'</a></code> s a -> a -> s
(#) :: <code><a href="Control-Lens-Type.html#t:Prism-39-">Prism'</a></code> s a -> a -> s
(#) :: <code><a href="Control-Lens-Review.html#t:Review-39-">Review'</a></code> s a -> a -> s
(#) :: <code><a href="Control-Lens-Type.html#t:Equality-39-">Equality'</a></code> s a -> a -> s
</pre></div></div><div class="top"><p class="src"><span class="keyword">class</span> <a name="t:Bifunctor" class="def">Bifunctor</a> p <span class="keyword">where</span></p><div class="doc"><p>Minimal definition either <code><a href="Control-Lens-Review.html#v:bimap">bimap</a></code> or <code><a href="/usr/share/doc/libghc-bifunctors-doc/html/Data-Bifunctor.html#v:first">first</a></code> and <code><a href="/usr/share/doc/libghc-bifunctors-doc/html/Data-Bifunctor.html#v:second">second</a></code>
</p><p>Formally, the class <code><a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a></code> represents a bifunctor
from <code>Hask</code> -> <code>Hask</code>.
</p><p>Intuitively it is a bifunctor where both the first and second arguments are covariant.
</p><p>You can define a <code><a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a></code> by either defining <code><a href="Control-Lens-Review.html#v:bimap">bimap</a></code> or by defining both
<code><a href="/usr/share/doc/libghc-bifunctors-doc/html/Data-Bifunctor.html#v:first">first</a></code> and <code><a href="/usr/share/doc/libghc-bifunctors-doc/html/Data-Bifunctor.html#v:second">second</a></code>.
</p><p>If you supply <code><a href="Control-Lens-Review.html#v:bimap">bimap</a></code>, you should ensure that:
</p><pre><code><a href="Control-Lens-Review.html#v:bimap">bimap</a></code> <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:id">id</a></code> <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:id">id</a></code> ≡ <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:id">id</a></code></pre><p>If you supply <code><a href="/usr/share/doc/libghc-bifunctors-doc/html/Data-Bifunctor.html#v:first">first</a></code> and <code><a href="/usr/share/doc/libghc-bifunctors-doc/html/Data-Bifunctor.html#v:second">second</a></code>, ensure:
</p><pre>
<code><a href="/usr/share/doc/libghc-bifunctors-doc/html/Data-Bifunctor.html#v:first">first</a></code> <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:id">id</a></code> ≡ <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:id">id</a></code>
<code><a href="/usr/share/doc/libghc-bifunctors-doc/html/Data-Bifunctor.html#v:second">second</a></code> <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:id">id</a></code> ≡ <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:id">id</a></code>
</pre><p>If you supply both, you should also ensure:
</p><pre><code><a href="Control-Lens-Review.html#v:bimap">bimap</a></code> f g ≡ <code><a href="/usr/share/doc/libghc-bifunctors-doc/html/Data-Bifunctor.html#v:first">first</a></code> f <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:.">.</a></code> <code><a href="/usr/share/doc/libghc-bifunctors-doc/html/Data-Bifunctor.html#v:second">second</a></code> g</pre><p>These ensure by parametricity:
</p><pre>
<code><a href="Control-Lens-Review.html#v:bimap">bimap</a></code> (f <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:.">.</a></code> g) (h <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:.">.</a></code> i) ≡ <code><a href="Control-Lens-Review.html#v:bimap">bimap</a></code> f h <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:.">.</a></code> <code><a href="Control-Lens-Review.html#v:bimap">bimap</a></code> g i
<code><a href="/usr/share/doc/libghc-bifunctors-doc/html/Data-Bifunctor.html#v:first">first</a></code> (f <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:.">.</a></code> g) ≡ <code><a href="/usr/share/doc/libghc-bifunctors-doc/html/Data-Bifunctor.html#v:first">first</a></code> f <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:.">.</a></code> <code><a href="/usr/share/doc/libghc-bifunctors-doc/html/Data-Bifunctor.html#v:first">first</a></code> g
<code><a href="/usr/share/doc/libghc-bifunctors-doc/html/Data-Bifunctor.html#v:second">second</a></code> (f <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:.">.</a></code> g) ≡ <code><a href="/usr/share/doc/libghc-bifunctors-doc/html/Data-Bifunctor.html#v:second">second</a></code> f <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:.">.</a></code> <code><a href="/usr/share/doc/libghc-bifunctors-doc/html/Data-Bifunctor.html#v:second">second</a></code> g
</pre></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:bimap" class="def">bimap</a> :: (a -> b) -> (c -> d) -> p a c -> p b d</p><div class="doc"><p>Map over both arguments at the same time.
</p><pre><code><a href="Control-Lens-Review.html#v:bimap">bimap</a></code> f g ≡ <code><a href="/usr/share/doc/libghc-bifunctors-doc/html/Data-Bifunctor.html#v:first">first</a></code> f <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:.">.</a></code> <code><a href="/usr/share/doc/libghc-bifunctors-doc/html/Data-Bifunctor.html#v:second">second</a></code> g</pre></div></div><div class="subs instances"><p id="control.i:Bifunctor" class="caption collapser" onclick="toggleSection('i:Bifunctor')">Instances</p><div id="section.i:Bifunctor" class="show"><table><tr><td class="src"><a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Either.html#t:Either">Either</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a> <a href="/usr/share/doc/ghc-doc/html/libraries/ghc-prim-0.3.0.0/GHC-Tuple.html#t:-40--44--41-">(,)</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a> <a href="Control-Lens-Getter.html#t:Const">Const</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a> (<a href="/usr/share/doc/ghc-doc/html/libraries/ghc-prim-0.3.0.0/GHC-Tuple.html#t:-40--44--44--41-">(,,)</a> x)</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> f => <a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a> (<a href="/usr/share/doc/libghc-free-doc/html/Control-Monad-Trans-Free.html#t:FreeF">FreeF</a> f)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a> (<a href="/usr/share/doc/libghc-tagged-doc/html/Data-Tagged.html#t:Tagged">Tagged</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/Control-Monad.html#t:Functor">Functor</a> f => <a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a> (<a href="Control-Lens-Internal-Getter.html#t:AlongsideRight">AlongsideRight</a> f)</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> f => <a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a> (<a href="Control-Lens-Internal-Getter.html#t:AlongsideLeft">AlongsideLeft</a> f)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a> (<a href="/usr/share/doc/ghc-doc/html/libraries/ghc-prim-0.3.0.0/GHC-Tuple.html#t:-40--44--44--44--41-">(,,,)</a> x y)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a> (<a href="/usr/share/doc/ghc-doc/html/libraries/ghc-prim-0.3.0.0/GHC-Tuple.html#t:-40--44--44--44--44--41-">(,,,,)</a> x y z)</td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:retagged" class="def">retagged</a> :: (<a href="Control-Lens-Iso.html#t:Profunctor">Profunctor</a> p, <a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a> p) => p a b -> p s b<a href="src/Control-Lens-Internal-Review.html#retagged" class="link">Source</a></p><div class="doc"><p>This is a profunctor used internally to implement <a href="Review.html">Review</a>
</p><p>It plays a role similar to that of <code><a href="Control-Lens-Internal-Getter.html#t:Accessor">Accessor</a></code>
or <code>Const</code> do for <a href="Control-Lens-Getter.html">Control.Lens.Getter</a>
</p></div></div><div class="top"><p class="src"><span class="keyword">class</span> (<a href="Control-Lens-Iso.html#t:Profunctor">Profunctor</a> p, <a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a> p) => <a name="t:Reviewable" class="def">Reviewable</a> p <a href="src/Control-Lens-Internal-Review.html#Reviewable" class="link">Source</a></p><div class="doc"><p>This class is provided mostly for backwards compatibility with lens 3.8,
but it can also shorten type signatures.
</p></div><div class="subs instances"><p id="control.i:Reviewable" class="caption collapser" onclick="toggleSection('i:Reviewable')">Instances</p><div id="section.i:Reviewable" class="show"><table><tr><td class="src">(<a href="Control-Lens-Iso.html#t:Profunctor">Profunctor</a> p, <a href="Control-Lens-Review.html#t:Bifunctor">Bifunctor</a> p) => <a href="Control-Lens-Review.html#t:Reviewable">Reviewable</a> p</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.13.2</p></div></body></html>
|