This file is indexed.

/usr/share/doc/libghc-uniplate-doc/html/Data-Generics-UniplateStr.html is in libghc-uniplate-doc 1.6.12-6.

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
<!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.Generics.UniplateStr</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-Generics-UniplateStr.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-Generics-UniplateStr.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">uniplate-1.6.12: Help writing simple, concise and fast generic operations.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Data.Generics.UniplateStr</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">The Class</a></li><li><a href="#g:2">The Operations</a><ul><li><a href="#g:3">Queries</a></li><li><a href="#g:4">Transformations</a></li><li><a href="#g:5">Others</a></li></ul></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p><em>DEPRECATED</em>: Use <a href="Data-Generics-Uniplate-Operations.html">Data.Generics.Uniplate.Operations</a> instead.</p><p>This is the main Uniplate module, which defines all the essential operations
in a Haskell 98 compatible manner.</p><p>Most functions have an example of a possible use for the function.
To illustate, I have used the <code>Expr</code> type as below:</p><pre>data Expr = Val Int
          | Neg Expr
          | Add Expr Expr</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:UniplateType">UniplateType</a> on = on -&gt; (<a href="Data-Generics-Str.html#t:Str">Str</a> on, <a href="Data-Generics-Str.html#t:Str">Str</a> on -&gt; on)</li><li class="src short"><span class="keyword">class</span> <a href="#t:Uniplate">Uniplate</a> on <span class="keyword">where</span><ul class="subs"></ul></li><li class="src short"><a href="#v:uniplateList">uniplateList</a> :: <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on =&gt; on -&gt; ([on], [on] -&gt; on)</li><li class="src short"><a href="#v:universe">universe</a> :: <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on =&gt; on -&gt; [on]</li><li class="src short"><a href="#v:children">children</a> :: <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on =&gt; on -&gt; [on]</li><li class="src short"><a href="#v:transform">transform</a> :: <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on =&gt; (on -&gt; on) -&gt; on -&gt; on</li><li class="src short"><a href="#v:transformM">transformM</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on) =&gt; (on -&gt; m on) -&gt; on -&gt; m on</li><li class="src short"><a href="#v:rewrite">rewrite</a> :: <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on =&gt; (on -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> on) -&gt; on -&gt; on</li><li class="src short"><a href="#v:rewriteM">rewriteM</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on) =&gt; (on -&gt; m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> on)) -&gt; on -&gt; m on</li><li class="src short"><a href="#v:descend">descend</a> :: <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on =&gt; (on -&gt; on) -&gt; on -&gt; on</li><li class="src short"><a href="#v:descendM">descendM</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on) =&gt; (on -&gt; m on) -&gt; on -&gt; m on</li><li class="src short"><a href="#v:contexts">contexts</a> :: <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on =&gt; on -&gt; [(on, on -&gt; on)]</li><li class="src short"><a href="#v:holes">holes</a> :: <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on =&gt; on -&gt; [(on, on -&gt; on)]</li><li class="src short"><a href="#v:para">para</a> :: <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on =&gt; (on -&gt; [r] -&gt; r) -&gt; on -&gt; r</li><li class="src short">module <a href="Data-Generics-Str.html">Data.Generics.Str</a></li></ul></div><div id="interface"><h1 id="g:1">The Class</h1><div class="top"><p class="src"><span class="keyword">type</span> <a id="t:UniplateType" class="def">UniplateType</a> on = on -&gt; (<a href="Data-Generics-Str.html#t:Str">Str</a> on, <a href="Data-Generics-Str.html#t:Str">Str</a> on -&gt; on) <a href="src/Data-Generics-UniplateStr.html#UniplateType" class="link">Source</a> <a href="#t:UniplateType" class="selflink">#</a></p><div class="doc"><p>The type of replacing all the children of a node</p><p>Taking a value, the function should return all the immediate children
   of the same type, and a function to replace them.</p></div></div><div class="top"><p class="src"><span class="keyword">class</span> <a id="t:Uniplate" class="def">Uniplate</a> on <span class="keyword">where</span> <a href="src/Data-Generics-UniplateStr.html#Uniplate" class="link">Source</a> <a href="#t:Uniplate" class="selflink">#</a></p><div class="doc"><p>The standard Uniplate class, all operations require this.</p></div><div class="subs minimal"><p class="caption">Minimal complete definition</p><p class="src"><a href="Data-Generics-UniplateStr.html#v:uniplate">uniplate</a></p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a id="v:uniplate" class="def">uniplate</a> :: <a href="Data-Generics-UniplateStr.html#t:UniplateType">UniplateType</a> on <a href="src/Data-Generics-UniplateStr.html#uniplate" class="link">Source</a> <a href="#v:uniplate" class="selflink">#</a></p><div class="doc"><p>The underlying method in the class.</p><p>Given <code>uniplate x = (cs, gen)</code></p><p><code>cs</code> should be a <code>Str on</code>, constructed of <code>Zero</code>, <code>One</code> and <code>Two</code>,
   containing all <code>x</code>'s direct children of the same type as <code>x</code>. <code>gen</code>
   should take a <code>Str on</code> with exactly the same structure as <code>cs</code>,
   and generate a new element with the children replaced.</p><p>Example instance:</p><pre>instance Uniplate Expr where
    uniplate (Val i  ) = (Zero               , \Zero                  -&gt; Val i  )
    uniplate (Neg a  ) = (One a              , \(One a)               -&gt; Neg a  )
    uniplate (Add a b) = (Two (One a) (One b), \(Two (One a) (One b)) -&gt; Add a b)</pre></div></div></div><div class="top"><p class="src"><a id="v:uniplateList" class="def">uniplateList</a> :: <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on =&gt; on -&gt; ([on], [on] -&gt; on) <a href="src/Data-Generics-UniplateStr.html#uniplateList" class="link">Source</a> <a href="#v:uniplateList" class="selflink">#</a></p><div class="doc"><p>Compatibility method, for direct users of the old list-based <code><a href="Data-Generics-UniplateStr.html#v:uniplate">uniplate</a></code> function</p></div></div><h1 id="g:2">The Operations</h1><h2 id="g:3">Queries</h2><div class="top"><p class="src"><a id="v:universe" class="def">universe</a> :: <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on =&gt; on -&gt; [on] <a href="src/Data-Generics-UniplateStr.html#universe" class="link">Source</a> <a href="#v:universe" class="selflink">#</a></p><div class="doc"><p>Get all the children of a node, including itself and all children.</p><pre>universe (Add (Val 1) (Neg (Val 2))) =
    [Add (Val 1) (Neg (Val 2)), Val 1, Neg (Val 2), Val 2]</pre><p>This method is often combined with a list comprehension, for example:</p><pre>vals x = [i | Val i &lt;- universe x]</pre></div></div><div class="top"><p class="src"><a id="v:children" class="def">children</a> :: <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on =&gt; on -&gt; [on] <a href="src/Data-Generics-UniplateStr.html#children" class="link">Source</a> <a href="#v:children" class="selflink">#</a></p><div class="doc"><p>Get the direct children of a node. Usually using <code><a href="Data-Generics-UniplateStr.html#v:universe">universe</a></code> is more appropriate.</p><pre>children = fst . <code><a href="Data-Generics-UniplateStr.html#v:uniplate">uniplate</a></code></pre></div></div><h2 id="g:4">Transformations</h2><div class="top"><p class="src"><a id="v:transform" class="def">transform</a> :: <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on =&gt; (on -&gt; on) -&gt; on -&gt; on <a href="src/Data-Generics-UniplateStr.html#transform" class="link">Source</a> <a href="#v:transform" class="selflink">#</a></p><div class="doc"><p>Transform every element in the tree, in a bottom-up manner.</p><p>For example, replacing negative literals with literals:</p><pre>negLits = transform f
   where f (Neg (Lit i)) = Lit (negate i)
         f x = x</pre></div></div><div class="top"><p class="src"><a id="v:transformM" class="def">transformM</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on) =&gt; (on -&gt; m on) -&gt; on -&gt; m on <a href="src/Data-Generics-UniplateStr.html#transformM" class="link">Source</a> <a href="#v:transformM" class="selflink">#</a></p><div class="doc"><p>Monadic variant of <code><a href="Data-Generics-UniplateStr.html#v:transform">transform</a></code></p></div></div><div class="top"><p class="src"><a id="v:rewrite" class="def">rewrite</a> :: <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on =&gt; (on -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> on) -&gt; on -&gt; on <a href="src/Data-Generics-UniplateStr.html#rewrite" class="link">Source</a> <a href="#v:rewrite" class="selflink">#</a></p><div class="doc"><p>Rewrite by applying a rule everywhere you can. Ensures that the rule cannot
 be applied anywhere in the result:</p><pre>propRewrite r x = all (isNothing . r) (universe (rewrite r x))</pre><p>Usually <code><a href="Data-Generics-UniplateStr.html#v:transform">transform</a></code> is more appropriate, but <code><a href="Data-Generics-UniplateStr.html#v:rewrite">rewrite</a></code> can give better
 compositionality. Given two single transformations <code>f</code> and <code>g</code>, you can
 construct <code>f <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Control-Monad.html#v:mplus">mplus</a></code> g</code> which performs both rewrites until a fixed point.</p></div></div><div class="top"><p class="src"><a id="v:rewriteM" class="def">rewriteM</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on) =&gt; (on -&gt; m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> on)) -&gt; on -&gt; m on <a href="src/Data-Generics-UniplateStr.html#rewriteM" class="link">Source</a> <a href="#v:rewriteM" class="selflink">#</a></p><div class="doc"><p>Monadic variant of <code><a href="Data-Generics-UniplateStr.html#v:rewrite">rewrite</a></code></p></div></div><div class="top"><p class="src"><a id="v:descend" class="def">descend</a> :: <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on =&gt; (on -&gt; on) -&gt; on -&gt; on <a href="src/Data-Generics-UniplateStr.html#descend" class="link">Source</a> <a href="#v:descend" class="selflink">#</a></p><div class="doc"><p>Perform a transformation on all the immediate children, then combine them back.
 This operation allows additional information to be passed downwards, and can be
 used to provide a top-down transformation.</p></div></div><div class="top"><p class="src"><a id="v:descendM" class="def">descendM</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on) =&gt; (on -&gt; m on) -&gt; on -&gt; m on <a href="src/Data-Generics-UniplateStr.html#descendM" class="link">Source</a> <a href="#v:descendM" class="selflink">#</a></p><div class="doc"><p>Monadic variant of <code><a href="Data-Generics-UniplateStr.html#v:descend">descend</a></code>    </p></div></div><h2 id="g:5">Others</h2><div class="top"><p class="src"><a id="v:contexts" class="def">contexts</a> :: <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on =&gt; on -&gt; [(on, on -&gt; on)] <a href="src/Data-Generics-UniplateStr.html#contexts" class="link">Source</a> <a href="#v:contexts" class="selflink">#</a></p><div class="doc"><p>Return all the contexts and holes.</p><pre>propUniverse x = universe x == map fst (contexts x)
propId x = all (== x) [b a | (a,b) &lt;- contexts x]</pre></div></div><div class="top"><p class="src"><a id="v:holes" class="def">holes</a> :: <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on =&gt; on -&gt; [(on, on -&gt; on)] <a href="src/Data-Generics-UniplateStr.html#holes" class="link">Source</a> <a href="#v:holes" class="selflink">#</a></p><div class="doc"><p>The one depth version of <code><a href="Data-Generics-UniplateStr.html#v:contexts">contexts</a></code></p><pre>propChildren x = children x == map fst (holes x)
propId x = all (== x) [b a | (a,b) &lt;- holes x]</pre></div></div><div class="top"><p class="src"><a id="v:para" class="def">para</a> :: <a href="Data-Generics-UniplateStr.html#t:Uniplate">Uniplate</a> on =&gt; (on -&gt; [r] -&gt; r) -&gt; on -&gt; r <a href="src/Data-Generics-UniplateStr.html#para" class="link">Source</a> <a href="#v:para" class="selflink">#</a></p><div class="doc"><p>Perform a fold-like computation on each value,
   technically a paramorphism</p></div></div><div class="top"><p class="src">module <a href="Data-Generics-Str.html">Data.Generics.Str</a></p></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>