Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > d4d89afd994d97d86f808e6225684a4f > files > 63

ghc-uniplate-devel-1.6-5.fc15.i686.rpm

<!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.Typeable</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-Typeable.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-Generics-Uniplate-Typeable.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: Help writing simple, concise and fast generic operations.</p></div><div id="content"><div id="module-header"><p class="caption">Data.Generics.Uniplate.Typeable</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 Combinators
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p><em>RECOMMENDATION:</em> Use <a href="Data-Generics-Uniplate-Data.html">Data.Generics.Uniplate.Data</a> instead - it usually performs
    faster (sometimes significantly so) and requires no special instance declarations.
</p><p>This module supplies a method for writing <code><a href="Data-Generics-Uniplate-Operations.html#t:Uniplate">Uniplate</a></code> / <code><a href="Data-Generics-Uniplate-Operations.html#t:Biplate">Biplate</a></code> instances. One
    instance declaration is required for each data type you wish to work with. The
    instances can be generated using Derive: <a href="http://community.haskell.org/~ndm/derive/">http://community.haskell.org/~ndm/derive/</a>.
</p><p>To take an example:
</p><pre> data Expr = Var Int | Neg Expr | Add Expr Expr
             deriving Typeable

 instance (Typeable a, Uniplate a) =&gt; PlateAll Expr a where
     plateAll (Var x  ) = plate Var |+ x
     plateAll (Neg x  ) = plate Neg |+ x
     plateAll (Add x y) = plate Add |+ x |+ y
</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">module <a href="Data-Generics-Uniplate-Operations.html">Data.Generics.Uniplate.Operations</a></li><li class="src short">module <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html">Data.Typeable</a></li><li class="src short"><span class="keyword">class</span>  <a href="#t:PlateAll">PlateAll</a> from to  <span class="keyword">where</span><ul class="subs"><li><a href="#v:plateAll">plateAll</a> :: from -&gt; Type from to</li></ul></li><li class="src short"><a href="#v:plate">plate</a> ::  from -&gt; Type from to</li><li class="src short"><a href="#v:-124--43-">(|+)</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> item, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> to, <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> item to) =&gt; Type (item -&gt; from) to -&gt; item -&gt; Type from to</li><li class="src short"><a href="#v:-124--45-">(|-)</a> ::  Type (item -&gt; from) to -&gt; item -&gt; Type from to</li><li class="src short"><a href="#v:plateProject">plateProject</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> item, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> to, <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> item to) =&gt; (from -&gt; item) -&gt; (item -&gt; from) -&gt; from -&gt; Type from to</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src">module <a href="Data-Generics-Uniplate-Operations.html">Data.Generics.Uniplate.Operations</a></p></div><div class="top"><p class="src">module <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html">Data.Typeable</a></p></div><h1 id="g:1">The Class
</h1><div class="top"><p class="src"><span class="keyword">class</span>  <a name="t:PlateAll" class="def">PlateAll</a> from to  <span class="keyword">where</span><a href="src/Data-Generics-Uniplate-Typeable.html#PlateAll" class="link">Source</a></p><div class="doc"><p>This class should be defined for each data type of interest.
</p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:plateAll" class="def">plateAll</a> :: from -&gt; Type from to<a href="src/Data-Generics-Uniplate-Typeable.html#plateAll" class="link">Source</a></p><div class="doc"><p>This method should be defined using <code><a href="Data-Generics-Uniplate-Typeable.html#v:plate">plate</a></code> and <code><a href="Data-Generics-Uniplate-Typeable.html#v:-124--43-">|+</a></code>, <code><a href="Data-Generics-Uniplate-Typeable.html#v:-124--45-">|-</a></code>.
</p></div></div><div class="subs instances"><p id="control.i:PlateAll" class="caption collapser" onclick="toggleSection('i:PlateAll')">Instances</p><div id="section.i:PlateAll" class="show"><table><tr><td class="src"><a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a> to</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:Char">Char</a> to</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Prelude.html#t:Double">Double</a> to</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Prelude.html#t:Float">Float</a> to</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> to</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Prelude.html#t:Integer">Integer</a> to</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> () to</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">(<a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> from to, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> from, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> to, <a href="Data-Generics-Uniplate-Operations.html#t:Uniplate">Uniplate</a> to) =&gt; <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> [from] to</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Prelude.html#t:Integral">Integral</a> a, <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> a to, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> to, <a href="Data-Generics-Uniplate-Operations.html#t:Uniplate">Uniplate</a> to) =&gt; <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Ratio.html#t:Ratio">Ratio</a> a) to</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">(<a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> from to, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> from, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> to, <a href="Data-Generics-Uniplate-Operations.html#t:Uniplate">Uniplate</a> to) =&gt; <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> from) to</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">(<a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> a to, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> a, <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> b to, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> b, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> to, <a href="Data-Generics-Uniplate-Operations.html#t:Uniplate">Uniplate</a> to) =&gt; <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Either.html#t:Either">Either</a> a b) to</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">(<a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> a to, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> a, <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> b to, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> b, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> to, <a href="Data-Generics-Uniplate-Operations.html#t:Uniplate">Uniplate</a> to) =&gt; <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> (a, b) to</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">(<a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> a to, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> a, <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> b to, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> b, <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> c to, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> c, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> to, <a href="Data-Generics-Uniplate-Operations.html#t:Uniplate">Uniplate</a> to) =&gt; <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> (a, b, c) to</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">(<a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> a to, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> a, <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> b to, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> b, <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> c to, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> c, <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> d to, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> d, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> to, <a href="Data-Generics-Uniplate-Operations.html#t:Uniplate">Uniplate</a> to) =&gt; <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> (a, b, c, d) to</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">(<a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> a to, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> a, <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> b to, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> b, <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> c to, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> c, <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> d to, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> d, <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> e to, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> e, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> to, <a href="Data-Generics-Uniplate-Operations.html#t:Uniplate">Uniplate</a> to) =&gt; <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> (a, b, c, d, e) to</td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><h1 id="g:2">The Combinators
</h1><div class="top"><p class="src"><a name="v:plate" class="def">plate</a> ::  from -&gt; Type from to<a href="src/Data-Generics-Uniplate-Typeable.html#plate" class="link">Source</a></p><div class="doc"><p>The main combinator used to start the chain.
</p></div></div><div class="top"><p class="src"><a name="v:-124--43-" class="def">(|+)</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> item, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> to, <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> item to) =&gt; Type (item -&gt; from) to -&gt; item -&gt; Type from to<a href="src/Data-Generics-Uniplate-Typeable.html#%7C%2B" class="link">Source</a></p><div class="doc"><p>The field to the right may contain the target.
</p></div></div><div class="top"><p class="src"><a name="v:-124--45-" class="def">(|-)</a> ::  Type (item -&gt; from) to -&gt; item -&gt; Type from to<a href="src/Data-Generics-Uniplate-Typeable.html#%7C-" class="link">Source</a></p><div class="doc"><p>The field to the right <em>does not</em> contain the target.
   This can be used as either an optimisation, or more commonly for excluding
   primitives such as Int.
</p></div></div><div class="top"><p class="src"><a name="v:plateProject" class="def">plateProject</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> item, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> to, <a href="Data-Generics-Uniplate-Typeable.html#t:PlateAll">PlateAll</a> item to) =&gt; (from -&gt; item) -&gt; (item -&gt; from) -&gt; from -&gt; Type from to<a href="src/Data-Generics-Uniplate-Typeable.html#plateProject" class="link">Source</a></p><div class="doc"><p>Write an instance in terms of a projection/injection pair. Usually used to define instances
   for abstract containers such as Map:
</p><pre> instance (Ord a, Typeable a, PlateAll a c, Typeable b, PlateAll b c,
          Typeable c, PlateAll c c) =&gt; PlateAll (Map.Map a b) c where
     plateAll = plateProject Map.toList Map.fromList
</pre></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.9.2</p></div></body></html>