This file is indexed.

/usr/share/doc/libghc-extra-doc/html/Data-Either-Extra.html is in libghc-extra-doc 1.4.10-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
<!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>Data.Either.Extra</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="file:///usr/share/javascript/mathjax/MathJax.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Data-Either-Extra.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-Either-Extra.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">extra-1.4.10: Extra functions I use.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>Safe</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">Data.Either.Extra</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>This module extends <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html">Data.Either</a> with extra operations, particularly
   to quickly extract from inside an <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html#t:Either">Either</a></code>. Some of these operations are
   partial, and should be used with care in production-quality 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">module <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html">Data.Either</a></li><li class="src short"><a href="#v:isLeft">isLeft</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html#t:Either">Either</a> a b -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isRight">isRight</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html#t:Either">Either</a> a b -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:fromLeft">fromLeft</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html#t:Either">Either</a> l r -&gt; l</li><li class="src short"><a href="#v:fromRight">fromRight</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html#t:Either">Either</a> l r -&gt; r</li><li class="src short"><a href="#v:fromEither">fromEither</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html#t:Either">Either</a> a a -&gt; a</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src">module <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html">Data.Either</a></p></div><div class="top"><p class="src"><a id="v:isLeft" class="def">isLeft</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html#t:Either">Either</a> a b -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:isLeft" class="selflink">#</a></p><div class="doc"><p>Return <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#v:True">True</a></code> if the given value is a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html#v:Left">Left</a></code>-value, <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#v:False">False</a></code> otherwise.</p><h4 id="control.ch:isLeft0" class="caption expander" onclick="toggleSection('ch:isLeft0')">Examples</h4><div id="section.ch:isLeft0" class="hide"><p>Basic usage:</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>isLeft (Left &quot;foo&quot;)
</code></strong>True
<code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>isLeft (Right 3)
</code></strong>False
</pre><p>Assuming a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html#v:Left">Left</a></code> value signifies some sort of error, we can use
 <code><a href="Data-Either-Extra.html#v:isLeft">isLeft</a></code> to write a very simple error-reporting function that does
 absolutely nothing in the case of success, and outputs &quot;ERROR&quot; if
 any error occurred.</p><p>This example shows how <code><a href="Data-Either-Extra.html#v:isLeft">isLeft</a></code> might be used to avoid pattern
 matching when one does not care about the value contained in the
 constructor:</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>import Control.Monad ( when )
</code></strong><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>let report e = when (isLeft e) $ putStrLn &quot;ERROR&quot;
</code></strong><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>report (Right 1)
</code></strong><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>report (Left &quot;parse error&quot;)
</code></strong>ERROR
</pre></div><p><em>Since: 4.7.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:isRight" class="def">isRight</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html#t:Either">Either</a> a b -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:isRight" class="selflink">#</a></p><div class="doc"><p>Return <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#v:True">True</a></code> if the given value is a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html#v:Right">Right</a></code>-value, <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#v:False">False</a></code> otherwise.</p><h4 id="control.ch:isRight0" class="caption expander" onclick="toggleSection('ch:isRight0')">Examples</h4><div id="section.ch:isRight0" class="hide"><p>Basic usage:</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>isRight (Left &quot;foo&quot;)
</code></strong>False
<code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>isRight (Right 3)
</code></strong>True
</pre><p>Assuming a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html#v:Left">Left</a></code> value signifies some sort of error, we can use
 <code><a href="Data-Either-Extra.html#v:isRight">isRight</a></code> to write a very simple reporting function that only
 outputs &quot;SUCCESS&quot; when a computation has succeeded.</p><p>This example shows how <code><a href="Data-Either-Extra.html#v:isRight">isRight</a></code> might be used to avoid pattern
 matching when one does not care about the value contained in the
 constructor:</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>import Control.Monad ( when )
</code></strong><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>let report e = when (isRight e) $ putStrLn &quot;SUCCESS&quot;
</code></strong><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>report (Left &quot;parse error&quot;)
</code></strong><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>report (Right 1)
</code></strong>SUCCESS
</pre></div><p><em>Since: 4.7.0.0</em></p></div></div><div class="top"><p class="src"><a id="v:fromLeft" class="def">fromLeft</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html#t:Either">Either</a> l r -&gt; l <a href="src/Data-Either-Extra.html#fromLeft" class="link">Source</a> <a href="#v:fromLeft" class="selflink">#</a></p><div class="doc"><p>The <code><a href="Data-Either-Extra.html#v:fromLeft">fromLeft</a></code> function extracts the element out of a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html#v:Left">Left</a></code> and
   throws an error if its argument is <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html#v:Right">Right</a></code>.
   Much like <code>fromJust</code>, using this function in polished code is usually a bad idea.</p><pre>\x -&gt; fromLeft (Left  x) == x
\x -&gt; fromLeft (Right x) == undefined</pre></div></div><div class="top"><p class="src"><a id="v:fromRight" class="def">fromRight</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html#t:Either">Either</a> l r -&gt; r <a href="src/Data-Either-Extra.html#fromRight" class="link">Source</a> <a href="#v:fromRight" class="selflink">#</a></p><div class="doc"><p>The <code><a href="Data-Either-Extra.html#v:fromRight">fromRight</a></code> function extracts the element out of a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html#v:Right">Right</a></code> and
   throws an error if its argument is <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html#v:Left">Left</a></code>.
   Much like <code>fromJust</code>, using this function in polished code is usually a bad idea.</p><pre>\x -&gt; fromRight (Right x) == x
\x -&gt; fromRight (Left  x) == undefined</pre></div></div><div class="top"><p class="src"><a id="v:fromEither" class="def">fromEither</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html#t:Either">Either</a> a a -&gt; a <a href="src/Data-Either-Extra.html#fromEither" class="link">Source</a> <a href="#v:fromEither" class="selflink">#</a></p><div class="doc"><p>Pull the value out of an <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Either.html#t:Either">Either</a></code> where both alternatives
   have the same type.</p><pre>\x -&gt; fromEither (Left x ) == x
\x -&gt; fromEither (Right x) == x</pre></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.2</p></div></body></html>