This file is indexed.

/usr/share/doc/libghc-lens-doc/html/Control-Lens-Prism.html is in libghc-lens-doc 4.13-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
 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
<!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.Prism</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-Prism.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Control-Lens-Prism.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.13: Lenses, Folds and Traversals</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Copyright</th><td>(C) 2012-15 Edward Kmett</td></tr><tr><th>License</th><td>BSD-style (see the file LICENSE)</td></tr><tr><th>Maintainer</th><td>Edward Kmett &lt;ekmett@gmail.com&gt;</td></tr><tr><th>Stability</th><td>provisional</td></tr><tr><th>Portability</th><td>non-portable</td></tr><tr><th>Safe Haskell</th><td>Trustworthy</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Control.Lens.Prism</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Prisms</a></li><li><a href="#g:2">Constructing Prisms</a></li><li><a href="#g:3">Consuming Prisms</a></li><li><a href="#g:4">Common Prisms</a></li><li><a href="#g:5">Prismatic profunctors</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc empty">&nbsp;</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:Prism">Prism</a> s t a b = <span class="keyword">forall</span> p f. (<a href="Control-Lens-Prism.html#t:Choice">Choice</a> p, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> f) =&gt; p a (f b) -&gt; p s (f t)</li><li class="src short"><span class="keyword">type</span> <a href="#t:Prism-39-">Prism'</a> s a = <a href="Control-Lens-Prism.html#t:Prism">Prism</a> s s a a</li><li class="src short"><span class="keyword">type</span> <a href="#t:APrism">APrism</a> s t a b = <a href="Control-Lens-Internal-Prism.html#t:Market">Market</a> a b a (<a href="Control-Lens-Setter.html#t:Identity">Identity</a> b) -&gt; <a href="Control-Lens-Internal-Prism.html#t:Market">Market</a> a b s (<a href="Control-Lens-Setter.html#t:Identity">Identity</a> t)</li><li class="src short"><span class="keyword">type</span> <a href="#t:APrism-39-">APrism'</a> s a = <a href="Control-Lens-Prism.html#t:APrism">APrism</a> s s a a</li><li class="src short"><a href="#v:prism">prism</a> :: (b -&gt; t) -&gt; (s -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> t a) -&gt; <a href="Control-Lens-Prism.html#t:Prism">Prism</a> s t a b</li><li class="src short"><a href="#v:prism-39-">prism'</a> :: (b -&gt; s) -&gt; (s -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> a) -&gt; <a href="Control-Lens-Prism.html#t:Prism">Prism</a> s s a b</li><li class="src short"><a href="#v:withPrism">withPrism</a> :: <a href="Control-Lens-Prism.html#t:APrism">APrism</a> s t a b -&gt; ((b -&gt; t) -&gt; (s -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> t a) -&gt; r) -&gt; r</li><li class="src short"><a href="#v:clonePrism">clonePrism</a> :: <a href="Control-Lens-Prism.html#t:APrism">APrism</a> s t a b -&gt; <a href="Control-Lens-Prism.html#t:Prism">Prism</a> s t a b</li><li class="src short"><a href="#v:outside">outside</a> :: <a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Rep.html#t:Representable">Representable</a> p =&gt; <a href="Control-Lens-Prism.html#t:APrism">APrism</a> s t a b -&gt; <a href="Control-Lens-Type.html#t:Lens">Lens</a> (p t r) (p s r) (p b r) (p a r)</li><li class="src short"><a href="#v:aside">aside</a> :: <a href="Control-Lens-Prism.html#t:APrism">APrism</a> s t a b -&gt; <a href="Control-Lens-Prism.html#t:Prism">Prism</a> (e, s) (e, t) (e, a) (e, b)</li><li class="src short"><a href="#v:without">without</a> :: <a href="Control-Lens-Prism.html#t:APrism">APrism</a> s t a b -&gt; <a href="Control-Lens-Prism.html#t:APrism">APrism</a> u v c d -&gt; <a href="Control-Lens-Prism.html#t:Prism">Prism</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> s u) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> t v) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> a c) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> b d)</li><li class="src short"><a href="#v:below">below</a> :: <a href="Control-Lens-Traversal.html#t:Traversable">Traversable</a> f =&gt; <a href="Control-Lens-Prism.html#t:APrism-39-">APrism'</a> s a -&gt; <a href="Control-Lens-Prism.html#t:Prism-39-">Prism'</a> (f s) (f a)</li><li class="src short"><a href="#v:isn-39-t">isn't</a> :: <a href="Control-Lens-Prism.html#t:APrism">APrism</a> s t a b -&gt; s -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:matching">matching</a> :: <a href="Control-Lens-Prism.html#t:APrism">APrism</a> s t a b -&gt; s -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> t a</li><li class="src short"><a href="#v:_Left">_Left</a> :: <a href="Control-Lens-Prism.html#t:Prism">Prism</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> a c) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> b c) a b</li><li class="src short"><a href="#v:_Right">_Right</a> :: <a href="Control-Lens-Prism.html#t:Prism">Prism</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> c a) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> c b) a b</li><li class="src short"><a href="#v:_Just">_Just</a> :: <a href="Control-Lens-Prism.html#t:Prism">Prism</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> a) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> b) a b</li><li class="src short"><a href="#v:_Nothing">_Nothing</a> :: <a href="Control-Lens-Prism.html#t:Prism-39-">Prism'</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> a) ()</li><li class="src short"><a href="#v:_Void">_Void</a> :: <a href="Control-Lens-Prism.html#t:Prism">Prism</a> s s a <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Void.html#t:Void">Void</a></li><li class="src short"><a href="#v:_Show">_Show</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Read.html#t:Read">Read</a> a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#t:Show">Show</a> a) =&gt; <a href="Control-Lens-Prism.html#t:Prism-39-">Prism'</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a> a</li><li class="src short"><a href="#v:only">only</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> a =&gt; a -&gt; <a href="Control-Lens-Prism.html#t:Prism-39-">Prism'</a> a ()</li><li class="src short"><a href="#v:nearly">nearly</a> :: a -&gt; (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Control-Lens-Prism.html#t:Prism-39-">Prism'</a> a ()</li><li class="src short"><span class="keyword">class</span> <a href="Control-Lens-Iso.html#t:Profunctor">Profunctor</a> p =&gt; <a href="#t:Choice">Choice</a> p <span class="keyword">where</span><ul class="subs"><li><a href="#v:left-39-">left'</a> :: p a b -&gt; p (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> a c) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> b c)</li><li><a href="#v:right-39-">right'</a> :: p a b -&gt; p (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> c a) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> c b)</li></ul></li></ul></div><div id="interface"><h1 id="g:1">Prisms</h1><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:Prism" class="def">Prism</a> s t a b = <span class="keyword">forall</span> p f. (<a href="Control-Lens-Prism.html#t:Choice">Choice</a> p, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> f) =&gt; p a (f b) -&gt; p s (f t) <a href="src/Control-Lens-Type.html#Prism" class="link">Source</a></p><div class="doc"><p>A <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> <code>l</code> is a <code><a href="Control-Lens-Type.html#t:Traversal">Traversal</a></code> that can also be turned
 around with <code><a href="Control-Lens-Review.html#v:re">re</a></code> to obtain a <code><a href="Control-Lens-Type.html#t:Getter">Getter</a></code> in the
 opposite direction.</p><p>There are two laws that a <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> should satisfy:</p><p>First, if I <code><a href="Control-Lens-Review.html#v:re">re</a></code> or <code><a href="Control-Lens-Review.html#v:review">review</a></code> a value with a <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> and then <code><a href="Control-Lens-Fold.html#v:preview">preview</a></code> or use (<code><a href="Control-Lens-Fold.html#v:-94--63-">^?</a></code>), I will get it back:</p><pre><code><a href="Control-Lens-Fold.html#v:preview">preview</a></code> l (<code><a href="Control-Lens-Review.html#v:review">review</a></code> l b) &#8801; <code>Just</code> b
</pre><p>Second, if you can extract a value <code>a</code> using a <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> <code>l</code> from a value <code>s</code>, then the value <code>s</code> is completely described by <code>l</code> and <code>a</code>:</p><p>If <code><code><a href="Control-Lens-Fold.html#v:preview">preview</a></code> l s &#8801; <code>Just</code> a</code> then <code><code><a href="Control-Lens-Review.html#v:review">review</a></code> l a &#8801; s</code></p><p>These two laws imply that the <code><a href="Control-Lens-Type.html#t:Traversal">Traversal</a></code> laws hold for every <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> and that we <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Traversable.html#v:traverse">traverse</a></code> at most 1 element:</p><pre><code><a href="Control-Lens-Fold.html#v:lengthOf">lengthOf</a></code> l x <code>&lt;=</code> 1
</pre><p>It may help to think of this as a <code><a href="Control-Lens-Type.html#t:Iso">Iso</a></code> that can be partial in one direction.</p><p>Every <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> is a valid <code><a href="Control-Lens-Type.html#t:Traversal">Traversal</a></code>.</p><p>Every <code><a href="Control-Lens-Type.html#t:Iso">Iso</a></code> is a valid <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code>.</p><p>For example, you might have a <code><code><a href="Control-Lens-Prism.html#t:Prism-39-">Prism'</a></code> <code>Integer</code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Numeric-Natural.html#v:Natural">Natural</a></code></code> allows you to always
 go from a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Numeric-Natural.html#v:Natural">Natural</a></code> to an <code>Integer</code>, and provide you with tools to check if an <code>Integer</code> is
 a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Numeric-Natural.html#v:Natural">Natural</a></code> and/or to edit one if it is.</p><pre><code>nat</code> :: <code><a href="Control-Lens-Prism.html#t:Prism-39-">Prism'</a></code> <code>Integer</code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Numeric-Natural.html#v:Natural">Natural</a></code>
<code>nat</code> = <code><a href="Control-Lens-Prism.html#v:prism">prism</a></code> <code>toInteger</code> <code>$</code> \ i -&gt;
   if i <code>&lt;</code> 0
   then <code>Left</code> i
   else <code>Right</code> (<code>fromInteger</code> i)
</pre><p>Now we can ask if an <code>Integer</code> is a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Numeric-Natural.html#v:Natural">Natural</a></code>.</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>5^?nat
</code></strong>Just 5
</pre><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>(-5)^?nat
</code></strong>Nothing
</pre><p>We can update the ones that are:</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>(-3,4) &amp; both.nat *~ 2
</code></strong>(-3,8)
</pre><p>And we can then convert from a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Numeric-Natural.html#v:Natural">Natural</a></code> to an <code>Integer</code>.</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>5 ^. re nat -- :: Natural
</code></strong>5
</pre><p>Similarly we can use a <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> to <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Traversable.html#v:traverse">traverse</a></code> the <code>Left</code> half of an <code>Either</code>:</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>Left &quot;hello&quot; &amp; _Left %~ length
</code></strong>Left 5
</pre><p>or to construct an <code>Either</code>:</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>5^.re _Left
</code></strong>Left 5
</pre><p>such that if you query it with the <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code>, you will get your original input back.</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>5^.re _Left ^? _Left
</code></strong>Just 5
</pre><p>Another interesting way to think of a <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> is as the categorical dual of a <code><a href="Control-Lens-Type.html#t:Lens">Lens</a></code>
 -- a co-<code><a href="Control-Lens-Type.html#t:Lens">Lens</a></code>, so to speak. This is what permits the construction of <code><a href="Control-Lens-Prism.html#v:outside">outside</a></code>.</p><p>Note: Composition with a <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> is index-preserving.</p></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:Prism-39-" class="def">Prism'</a> s a = <a href="Control-Lens-Prism.html#t:Prism">Prism</a> s s a a <a href="src/Control-Lens-Type.html#Prism%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-Prism.html#t:Prism">Prism</a></code>.</p></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:APrism" class="def">APrism</a> s t a b = <a href="Control-Lens-Internal-Prism.html#t:Market">Market</a> a b a (<a href="Control-Lens-Setter.html#t:Identity">Identity</a> b) -&gt; <a href="Control-Lens-Internal-Prism.html#t:Market">Market</a> a b s (<a href="Control-Lens-Setter.html#t:Identity">Identity</a> t) <a href="src/Control-Lens-Prism.html#APrism" 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-Prism.html#t:Prism">Prism</a></code>.</p></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:APrism-39-" class="def">APrism'</a> s a = <a href="Control-Lens-Prism.html#t:APrism">APrism</a> s s a a <a href="src/Control-Lens-Prism.html#APrism%27" class="link">Source</a></p><div class="doc"><pre>type APrism' = <code><a href="Control-Lens-Type.html#t:Simple">Simple</a></code> <code><a href="Control-Lens-Prism.html#t:APrism">APrism</a></code>
</pre></div></div><h1 id="g:2">Constructing Prisms</h1><div class="top"><p class="src"><a name="v:prism" class="def">prism</a> :: (b -&gt; t) -&gt; (s -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> t a) -&gt; <a href="Control-Lens-Prism.html#t:Prism">Prism</a> s t a b <a href="src/Control-Lens-Prism.html#prism" class="link">Source</a></p><div class="doc"><p>Build a <code><a href="Control-Lens-Prism.html#v:Prism">Prism</a></code>.</p><p><code><code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a></code> t a</code> is used instead of <code><code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a></code> a</code> to permit the types of <code>s</code> and <code>t</code> to differ.</p></div></div><div class="top"><p class="src"><a name="v:prism-39-" class="def">prism'</a> :: (b -&gt; s) -&gt; (s -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> a) -&gt; <a href="Control-Lens-Prism.html#t:Prism">Prism</a> s s a b <a href="src/Control-Lens-Prism.html#prism%27" class="link">Source</a></p><div class="doc"><p>This is usually used to build a <code><a href="Control-Lens-Prism.html#t:Prism-39-">Prism'</a></code>, when you have to use an operation like
 <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Typeable.html#v:cast">cast</a></code> which already returns a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a></code>.</p></div></div><h1 id="g:3">Consuming Prisms</h1><div class="top"><p class="src"><a name="v:withPrism" class="def">withPrism</a> :: <a href="Control-Lens-Prism.html#t:APrism">APrism</a> s t a b -&gt; ((b -&gt; t) -&gt; (s -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> t a) -&gt; r) -&gt; r <a href="src/Control-Lens-Prism.html#withPrism" class="link">Source</a></p><div class="doc"><p>Convert <code><a href="Control-Lens-Prism.html#t:APrism">APrism</a></code> to the pair of functions that characterize it.</p></div></div><div class="top"><p class="src"><a name="v:clonePrism" class="def">clonePrism</a> :: <a href="Control-Lens-Prism.html#t:APrism">APrism</a> s t a b -&gt; <a href="Control-Lens-Prism.html#t:Prism">Prism</a> s t a b <a href="src/Control-Lens-Prism.html#clonePrism" class="link">Source</a></p><div class="doc"><p>Clone a <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> so that you can reuse the same monomorphically typed <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> for different purposes.</p><p>See <code><a href="Control-Lens-Lens.html#v:cloneLens">cloneLens</a></code> and <code><a href="Control-Lens-Traversal.html#v:cloneTraversal">cloneTraversal</a></code> for examples of why you might want to do this.</p></div></div><div class="top"><p class="src"><a name="v:outside" class="def">outside</a> :: <a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Rep.html#t:Representable">Representable</a> p =&gt; <a href="Control-Lens-Prism.html#t:APrism">APrism</a> s t a b -&gt; <a href="Control-Lens-Type.html#t:Lens">Lens</a> (p t r) (p s r) (p b r) (p a r) <a href="src/Control-Lens-Prism.html#outside" class="link">Source</a></p><div class="doc"><p>Use a <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> as a kind of first-class pattern.</p><pre><code><a href="Control-Lens-Prism.html#v:outside">outside</a></code> :: <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> s t a b -&gt; <code><a href="Control-Lens-Type.html#t:Lens">Lens</a></code> (t -&gt; r) (s -&gt; r) (b -&gt; r) (a -&gt; r)</pre></div></div><div class="top"><p class="src"><a name="v:aside" class="def">aside</a> :: <a href="Control-Lens-Prism.html#t:APrism">APrism</a> s t a b -&gt; <a href="Control-Lens-Prism.html#t:Prism">Prism</a> (e, s) (e, t) (e, a) (e, b) <a href="src/Control-Lens-Prism.html#aside" class="link">Source</a></p><div class="doc"><p>Use a <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> to work over part of a structure.</p></div></div><div class="top"><p class="src"><a name="v:without" class="def">without</a> :: <a href="Control-Lens-Prism.html#t:APrism">APrism</a> s t a b -&gt; <a href="Control-Lens-Prism.html#t:APrism">APrism</a> u v c d -&gt; <a href="Control-Lens-Prism.html#t:Prism">Prism</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> s u) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> t v) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> a c) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> b d) <a href="src/Control-Lens-Prism.html#without" class="link">Source</a></p><div class="doc"><p>Given a pair of prisms, project sums.</p><p>Viewing a <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> as a co-<code><a href="Control-Lens-Type.html#t:Lens">Lens</a></code>, this combinator can be seen to be dual to <code><a href="Control-Lens-Lens.html#v:alongside">alongside</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:below" class="def">below</a> :: <a href="Control-Lens-Traversal.html#t:Traversable">Traversable</a> f =&gt; <a href="Control-Lens-Prism.html#t:APrism-39-">APrism'</a> s a -&gt; <a href="Control-Lens-Prism.html#t:Prism-39-">Prism'</a> (f s) (f a) <a href="src/Control-Lens-Prism.html#below" class="link">Source</a></p><div class="doc"><p><code>lift</code> a <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> through a <code><a href="Control-Lens-Traversal.html#t:Traversable">Traversable</a></code> functor, giving a Prism that matches only if all the elements of the container match the <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code>.</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>[Left 1, Right &quot;foo&quot;, Left 4, Right &quot;woot&quot;]^..below _Right
</code></strong>[]
</pre><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>[Right &quot;hail hydra!&quot;, Right &quot;foo&quot;, Right &quot;blah&quot;, Right &quot;woot&quot;]^..below _Right
</code></strong>[[&quot;hail hydra!&quot;,&quot;foo&quot;,&quot;blah&quot;,&quot;woot&quot;]]
</pre></div></div><div class="top"><p class="src"><a name="v:isn-39-t" class="def">isn't</a> :: <a href="Control-Lens-Prism.html#t:APrism">APrism</a> s t a b -&gt; s -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Control-Lens-Prism.html#isn%27t" class="link">Source</a></p><div class="doc"><p>Check to see if this <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> doesn't match.</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>isn't _Left (Right 12)
</code></strong>True
</pre><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>isn't _Left (Left 12)
</code></strong>False
</pre><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>isn't _Empty []
</code></strong>False
</pre></div></div><div class="top"><p class="src"><a name="v:matching" class="def">matching</a> :: <a href="Control-Lens-Prism.html#t:APrism">APrism</a> s t a b -&gt; s -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> t a <a href="src/Control-Lens-Prism.html#matching" class="link">Source</a></p><div class="doc"><p>Retrieve the value targeted by a <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> or return the
 original value while allowing the type to change if it does
 not match.</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>matching _Just (Just 12)
</code></strong>Right 12
</pre><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>matching _Just (Nothing :: Maybe Int) :: Either (Maybe Bool) Int
</code></strong>Left Nothing
</pre></div></div><h1 id="g:4">Common Prisms</h1><div class="top"><p class="src"><a name="v:_Left" class="def">_Left</a> :: <a href="Control-Lens-Prism.html#t:Prism">Prism</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> a c) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> b c) a b <a href="src/Control-Lens-Prism.html#_Left" class="link">Source</a></p><div class="doc"><p>This <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> provides a <code><a href="Control-Lens-Type.html#t:Traversal">Traversal</a></code> for tweaking the <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#v:Left">Left</a></code> half of an <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a></code>:</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>over _Left (+1) (Left 2)
</code></strong>Left 3
</pre><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>over _Left (+1) (Right 2)
</code></strong>Right 2
</pre><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>Right 42 ^._Left :: String
</code></strong>&quot;&quot;
</pre><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>Left &quot;hello&quot; ^._Left
</code></strong>&quot;hello&quot;
</pre><p>It also can be turned around to obtain the embedding into the <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#v:Left">Left</a></code> half of an <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a></code>:</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>_Left # 5
</code></strong>Left 5
</pre><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>5^.re _Left
</code></strong>Left 5
</pre></div></div><div class="top"><p class="src"><a name="v:_Right" class="def">_Right</a> :: <a href="Control-Lens-Prism.html#t:Prism">Prism</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> c a) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> c b) a b <a href="src/Control-Lens-Prism.html#_Right" class="link">Source</a></p><div class="doc"><p>This <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> provides a <code><a href="Control-Lens-Type.html#t:Traversal">Traversal</a></code> for tweaking the <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#v:Right">Right</a></code> half of an <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a></code>:</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>over _Right (+1) (Left 2)
</code></strong>Left 2
</pre><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>over _Right (+1) (Right 2)
</code></strong>Right 3
</pre><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>Right &quot;hello&quot; ^._Right
</code></strong>&quot;hello&quot;
</pre><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>Left &quot;hello&quot; ^._Right :: [Double]
</code></strong>[]
</pre><p>It also can be turned around to obtain the embedding into the <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#v:Right">Right</a></code> half of an <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a></code>:</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>_Right # 5
</code></strong>Right 5
</pre><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>5^.re _Right
</code></strong>Right 5
</pre></div></div><div class="top"><p class="src"><a name="v:_Just" class="def">_Just</a> :: <a href="Control-Lens-Prism.html#t:Prism">Prism</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> a) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> b) a b <a href="src/Control-Lens-Prism.html#_Just" class="link">Source</a></p><div class="doc"><p>This <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> provides a <code><a href="Control-Lens-Type.html#t:Traversal">Traversal</a></code> for tweaking the target of the value of <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#v:Just">Just</a></code> in a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a></code>.</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>over _Just (+1) (Just 2)
</code></strong>Just 3
</pre><p>Unlike <code><a href="Control-Lens-Traversal.html#v:traverse">traverse</a></code> this is a <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code>, and so you can use it to inject as well:</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>_Just # 5
</code></strong>Just 5
</pre><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>5^.re _Just
</code></strong>Just 5
</pre><p>Interestingly,</p><pre>m <code>^?</code> <code><a href="Control-Lens-Prism.html#v:_Just">_Just</a></code> &#8801; m
</pre><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>Just x ^? _Just
</code></strong>Just x
</pre><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>Nothing ^? _Just
</code></strong>Nothing
</pre></div></div><div class="top"><p class="src"><a name="v:_Nothing" class="def">_Nothing</a> :: <a href="Control-Lens-Prism.html#t:Prism-39-">Prism'</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> a) () <a href="src/Control-Lens-Prism.html#_Nothing" class="link">Source</a></p><div class="doc"><p>This <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> provides the <code><a href="Control-Lens-Type.html#t:Traversal">Traversal</a></code> of a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#v:Nothing">Nothing</a></code> in a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a></code>.</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>Nothing ^? _Nothing
</code></strong>Just ()
</pre><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>Just () ^? _Nothing
</code></strong>Nothing
</pre><p>But you can turn it around and use it to construct <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#v:Nothing">Nothing</a></code> as well:</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>_Nothing # ()
</code></strong>Nothing
</pre></div></div><div class="top"><p class="src"><a name="v:_Void" class="def">_Void</a> :: <a href="Control-Lens-Prism.html#t:Prism">Prism</a> s s a <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Void.html#t:Void">Void</a> <a href="src/Control-Lens-Prism.html#_Void" class="link">Source</a></p><div class="doc"><p><code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Void.html#t:Void">Void</a></code> is a logically uninhabited data type.</p><p>This is a <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> that will always fail to match.</p></div></div><div class="top"><p class="src"><a name="v:_Show" class="def">_Show</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Read.html#t:Read">Read</a> a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#t:Show">Show</a> a) =&gt; <a href="Control-Lens-Prism.html#t:Prism-39-">Prism'</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a> a <a href="src/Control-Lens-Prism.html#_Show" class="link">Source</a></p><div class="doc"><p>This is an improper prism for text formatting based on <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Read.html#t:Read">Read</a></code> and <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#t:Show">Show</a></code>.</p><p>This <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> is &quot;improper&quot; in the sense that it normalizes the text formatting, but round tripping
 is idempotent given sane 'Read'/'Show' instances.</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>_Show # 2
</code></strong>&quot;2&quot;
</pre><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>&quot;EQ&quot; ^? _Show :: Maybe Ordering
</code></strong>Just EQ
</pre><pre><code><a href="Control-Lens-Prism.html#v:_Show">_Show</a></code> &#8801; <code><a href="Control-Lens-Prism.html#v:prism-39-">prism'</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#v:show">show</a></code> <code>readMaybe</code>
</pre></div></div><div class="top"><p class="src"><a name="v:only" class="def">only</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> a =&gt; a -&gt; <a href="Control-Lens-Prism.html#t:Prism-39-">Prism'</a> a () <a href="src/Control-Lens-Prism.html#only" class="link">Source</a></p><div class="doc"><p>This <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> compares for exact equality with a given value.</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>only 4 # ()
</code></strong>4
</pre><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>5 ^? only 4
</code></strong>Nothing
</pre></div></div><div class="top"><p class="src"><a name="v:nearly" class="def">nearly</a> :: a -&gt; (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Control-Lens-Prism.html#t:Prism-39-">Prism'</a> a () <a href="src/Control-Lens-Prism.html#nearly" class="link">Source</a></p><div class="doc"><p>This <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> compares for approximate equality with a given value and a predicate for testing, 
 an example where the value is the empty list and the predicate checks that a list is empty (same
 as <code><a href="Control-Lens-Empty.html#v:_Empty">_Empty</a></code> with the <code><a href="Control-Lens-Empty.html#v:AsEmpty">AsEmpty</a></code> list instance):</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>nearly [] null # ()
</code></strong>[]
<code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>[1,2,3,4] ^? nearly [] null
</code></strong>Nothing
</pre><pre><code><a href="Control-Lens-Prism.html#v:nearly">nearly</a></code> [] <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:null">null</a></code> :: <code><a href="Control-Lens-Prism.html#t:Prism-39-">Prism'</a></code> [a] ()</pre><p>To comply with the <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code> laws the arguments you supply to <code>nearly a p</code> are somewhat constrained.</p><p>We assume <code>p x</code> holds iff <code>x &#8801; a</code>. Under that assumption then this is a valid <code><a href="Control-Lens-Prism.html#t:Prism">Prism</a></code>.</p><p>This is useful when working with a type where you can test equality for only a subset of its
 values, and the prism selects such a value. </p></div></div><h1 id="g:5">Prismatic profunctors</h1><div class="top"><p class="src"><span class="keyword">class</span> <a href="Control-Lens-Iso.html#t:Profunctor">Profunctor</a> p =&gt; <a name="t:Choice" class="def">Choice</a> p <span class="keyword">where</span></p><div class="doc"><p>The generalization of <code><a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor.html#t:Costar">Costar</a></code> of <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a></code> that is strong with respect
 to <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a></code>.</p><p>Note: This is also a notion of strength, except with regards to another monoidal
 structure that we can choose to equip Hask with: the cocartesian coproduct.</p></div><div class="subs minimal"><p class="caption">Minimal complete definition</p><p class="src"><a href="Control-Lens-Prism.html#v:left-39-">left'</a> | <a href="Control-Lens-Prism.html#v:right-39-">right'</a></p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:left-39-" class="def">left'</a> :: p a b -&gt; p (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> a c) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> b c)</p><p class="src"><a name="v:right-39-" class="def">right'</a> :: p a b -&gt; p (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> c a) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> c b)</p></div><div class="subs instances"><p id="control.i:Choice" class="caption collapser" onclick="toggleSection('i:Choice')">Instances</p><div id="section.i:Choice" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Prism.html#t:Choice">Choice</a> (-&gt;)</span></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Prism.html#t:Choice">Choice</a> <a href="Control-Lens-Reified.html#t:ReifiedFold">ReifiedFold</a></span></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Prism.html#t:Choice">Choice</a> <a href="Control-Lens-Reified.html#t:ReifiedGetter">ReifiedGetter</a></span></td><td class="doc empty">&nbsp;</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 =&gt; <a href="Control-Lens-Prism.html#t:Choice">Choice</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:Kleisli">Kleisli</a> m)</span></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/libghc-comonad-doc/html/Control-Comonad.html#t:Comonad">Comonad</a> w =&gt; <a href="Control-Lens-Prism.html#t:Choice">Choice</a> (<a href="file:///usr/share/doc/libghc-comonad-doc/html/Control-Comonad.html#t:Cokleisli">Cokleisli</a> w)</span></td><td class="doc"><p><code><a href="file:///usr/share/doc/libghc-comonad-doc/html/Control-Comonad.html#v:extract">extract</a></code> approximates <code>costrength</code></p></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-Applicative.html#t:Applicative">Applicative</a> f =&gt; <a href="Control-Lens-Prism.html#t:Choice">Choice</a> (<a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor.html#t:Star">Star</a> f)</span></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Traversal.html#t:Traversable">Traversable</a> w =&gt; <a href="Control-Lens-Prism.html#t:Choice">Choice</a> (<a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor.html#t:Costar">Costar</a> w)</span></td><td class="doc empty">&nbsp;</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-Arrow.html#t:ArrowChoice">ArrowChoice</a> p =&gt; <a href="Control-Lens-Prism.html#t:Choice">Choice</a> (<a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor.html#t:WrappedArrow">WrappedArrow</a> p)</span></td><td class="doc empty">&nbsp;</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> r =&gt; <a href="Control-Lens-Prism.html#t:Choice">Choice</a> (<a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor.html#t:Forget">Forget</a> r)</span></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Prism.html#t:Choice">Choice</a> (<a href="file:///usr/share/doc/libghc-tagged-doc/html/Data-Tagged.html#t:Tagged">Tagged</a> *)</span></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Prism.html#t:Choice">Choice</a> (<a href="Control-Lens-Internal-Indexed.html#t:Indexed">Indexed</a> i)</span></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Prism.html#t:Choice">Choice</a> (<a href="Control-Lens-Internal-Prism.html#t:Market">Market</a> a b)</span></td><td class="doc empty">&nbsp;</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>