This file is indexed.

/usr/share/doc/libghc-uniplate-doc/html/Data-Generics-Uniplate.html is in libghc-uniplate-doc 1.6.12-4build1.

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
<!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.Uniplate</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_Data-Generics-Uniplate.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-Generics-Uniplate.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.Uniplate</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; ([on], [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"><li><a href="#v:uniplate">uniplate</a> :: <a href="Data-Generics-Uniplate.html#t:UniplateType">UniplateType</a> on</li></ul></li><li class="src short"><a href="#v:universe">universe</a> :: <a href="Data-Generics-Uniplate.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-Uniplate.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-Uniplate.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.8.2.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Generics-Uniplate.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-Uniplate.html#t:Uniplate">Uniplate</a> on =&gt; (on -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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.8.2.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Generics-Uniplate.html#t:Uniplate">Uniplate</a> on) =&gt; (on -&gt; m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.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-Uniplate.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.8.2.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Generics-Uniplate.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-Uniplate.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-Uniplate.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-Uniplate.html#t:Uniplate">Uniplate</a> on =&gt; (on -&gt; [r] -&gt; r) -&gt; on -&gt; r</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 name="t:UniplateType" class="def">UniplateType</a> on = on -&gt; ([on], [on] -&gt; on) <a href="src/Data-Generics-Uniplate.html#UniplateType" class="link">Source</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 name="t:Uniplate" class="def">Uniplate</a> on <span class="keyword">where</span> <a href="src/Data-Generics-Uniplate.html#Uniplate" class="link">Source</a></p><div class="doc"><p>The standard Uniplate class, all operations require this</p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:uniplate" class="def">uniplate</a> :: <a href="Data-Generics-Uniplate.html#t:UniplateType">UniplateType</a> on <a href="src/Data-Generics-Uniplate.html#uniplate" class="link">Source</a></p><div class="doc"><p>The underlying method in the class</p><pre>uniplate (Add (Val 1) (Neg (Val 2))) = ([Val 1, Neg (Val 2)], \[a,b] -&gt; Add a b)
uniplate (Val 1)                     = ([]                  , \[]    -&gt; Val 1  )</pre></div></div></div><h1 id="g:2">The Operations</h1><h2 id="g:3">Queries</h2><div class="top"><p class="src"><a name="v:universe" class="def">universe</a> :: <a href="Data-Generics-Uniplate.html#t:Uniplate">Uniplate</a> on =&gt; on -&gt; [on] <a href="src/Data-Generics-Uniplate.html#universe" class="link">Source</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 name="v:children" class="def">children</a> :: <a href="Data-Generics-Uniplate.html#t:Uniplate">Uniplate</a> on =&gt; on -&gt; [on] <a href="src/Data-Generics-Uniplate.html#children" class="link">Source</a></p><div class="doc"><p>Get the direct children of a node. Usually using <code><a href="Data-Generics-Uniplate.html#v:universe">universe</a></code> is more appropriate.</p><pre>children = fst . <code><a href="Data-Generics-Uniplate.html#v:uniplate">uniplate</a></code></pre></div></div><h2 id="g:4">Transformations</h2><div class="top"><p class="src"><a name="v:transform" class="def">transform</a> :: <a href="Data-Generics-Uniplate.html#t:Uniplate">Uniplate</a> on =&gt; (on -&gt; on) -&gt; on -&gt; on <a href="src/Data-Generics-Uniplate.html#transform" class="link">Source</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 name="v:transformM" class="def">transformM</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Generics-Uniplate.html#t:Uniplate">Uniplate</a> on) =&gt; (on -&gt; m on) -&gt; on -&gt; m on <a href="src/Data-Generics-Uniplate.html#transformM" class="link">Source</a></p><div class="doc"><p>Monadic variant of <code><a href="Data-Generics-Uniplate.html#v:transform">transform</a></code></p></div></div><div class="top"><p class="src"><a name="v:rewrite" class="def">rewrite</a> :: <a href="Data-Generics-Uniplate.html#t:Uniplate">Uniplate</a> on =&gt; (on -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> on) -&gt; on -&gt; on <a href="src/Data-Generics-Uniplate.html#rewrite" class="link">Source</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-Uniplate.html#v:transform">transform</a></code> is more appropriate, but <code><a href="Data-Generics-Uniplate.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.8.2.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 name="v:rewriteM" class="def">rewriteM</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Generics-Uniplate.html#t:Uniplate">Uniplate</a> on) =&gt; (on -&gt; m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> on)) -&gt; on -&gt; m on <a href="src/Data-Generics-Uniplate.html#rewriteM" class="link">Source</a></p><div class="doc"><p>Monadic variant of <code><a href="Data-Generics-Uniplate.html#v:rewrite">rewrite</a></code></p></div></div><div class="top"><p class="src"><a name="v:descend" class="def">descend</a> :: <a href="Data-Generics-Uniplate.html#t:Uniplate">Uniplate</a> on =&gt; (on -&gt; on) -&gt; on -&gt; on <a href="src/Data-Generics-Uniplate.html#descend" class="link">Source</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 name="v:descendM" class="def">descendM</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Generics-Uniplate.html#t:Uniplate">Uniplate</a> on) =&gt; (on -&gt; m on) -&gt; on -&gt; m on <a href="src/Data-Generics-Uniplate.html#descendM" class="link">Source</a></p><div class="doc"><p>Monadic variant of <code><a href="Data-Generics-Uniplate.html#v:descend">descend</a></code>    </p></div></div><h2 id="g:5">Others</h2><div class="top"><p class="src"><a name="v:contexts" class="def">contexts</a> :: <a href="Data-Generics-Uniplate.html#t:Uniplate">Uniplate</a> on =&gt; on -&gt; [(on, on -&gt; on)] <a href="src/Data-Generics-Uniplate.html#contexts" class="link">Source</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 name="v:holes" class="def">holes</a> :: <a href="Data-Generics-Uniplate.html#t:Uniplate">Uniplate</a> on =&gt; on -&gt; [(on, on -&gt; on)] <a href="src/Data-Generics-Uniplate.html#holes" class="link">Source</a></p><div class="doc"><p>The one depth version of <code><a href="Data-Generics-Uniplate.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 name="v:para" class="def">para</a> :: <a href="Data-Generics-Uniplate.html#t:Uniplate">Uniplate</a> on =&gt; (on -&gt; [r] -&gt; r) -&gt; on -&gt; r <a href="src/Data-Generics-Uniplate.html#para" class="link">Source</a></p><div class="doc"><p>Perform a fold-like computation on each value,
   technically a paramorphism</p></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>