<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--Rendered using the Haskell Html Library v0.2--> <HTML ><HEAD ><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" ><TITLE >Control.Arrow.ArrowTree</TITLE ><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" ><SCRIPT SRC="haddock-util.js" TYPE="text/javascript" ></SCRIPT ><SCRIPT TYPE="text/javascript" >window.onload = function () {setSynopsis("mini_Control-Arrow-ArrowTree.html")};</SCRIPT ></HEAD ><BODY ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="topbar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " ></TD ><TD CLASS="title" >hxt-8.3.2: A collection of tools for processing XML with Haskell.</TD ><TD CLASS="topbut" ><A HREF="index.html" >Contents</A ></TD ><TD CLASS="topbut" ><A HREF="doc-index.html" >Index</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="modulebar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><FONT SIZE="6" >Control.Arrow.ArrowTree</FONT ></TD ><TD ALIGN="right" ><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="infohead" >Portability</TD ><TD CLASS="infoval" >portable</TD ></TR ><TR ><TD CLASS="infohead" >Stability</TD ><TD CLASS="infoval" >experimental</TD ></TR ><TR ><TD CLASS="infohead" >Maintainer</TD ><TD CLASS="infoval" >Uwe Schmidt (uwe\@fh-wedel.de)</TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Description</TD ></TR ><TR ><TD CLASS="doc" ><P >Version : $Id: ArrowTree.hs,v 1.12 2006<EM >11</EM >30 16:05:24 hxml Exp $ </P ><P >List arrows for tree processing. </P ><P >Trees that implement the <A HREF="Data-Tree-Class.html" >Data.Tree.Class</A > interface, can be processed with these arrows. </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Synopsis</TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >class</SPAN > (<A HREF="/usr/share/doc/ghc/libraries/base/Control-Arrow.html#t%3AArrowPlus" >ArrowPlus</A > a, <A HREF="Control-Arrow-ArrowIf.html#t%3AArrowIf" >ArrowIf</A > a) => <A HREF="#t%3AArrowTree" >ArrowTree</A > a <SPAN CLASS="keyword" >where</SPAN ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkLeaf" >mkLeaf</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => b -> a c (t b)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkTree" >mkTree</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => b -> [t b] -> a c (t b)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AgetChildren" >getChildren</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) (t b)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AgetNode" >getNode</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) b</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AsetChildren" >setChildren</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => [t b] -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AsetNode" >setNode</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => b -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AchangeChildren" >changeChildren</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => ([t b] -> [t b]) -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AchangeNode" >changeNode</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => (b -> b) -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AprocessChildren" >processChildren</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) (t b) -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AreplaceChildren" >replaceChildren</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) (t b) -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3A%2F%3E" >(/>)</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a b (t c) -> a (t c) d -> a b d</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3A%2F%2F%3E" >(//>)</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a b (t c) -> a (t c) d -> a b d</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3A%3C%2F" >(</)</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) (t b) -> a (t b) (t b) -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Adeep" >deep</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) c -> a (t b) c</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Adeepest" >deepest</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) c -> a (t b) c</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Amulti" >multi</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) c -> a (t b) c</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AprocessBottomUp" >processBottomUp</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) (t b) -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AprocessTopDown" >processTopDown</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) (t b) -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AprocessBottomUpWhenNot" >processBottomUpWhenNot</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) (t b) -> a (t b) (t b) -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AprocessTopDownUntil" >processTopDownUntil</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) (t b) -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AinsertChildrenAt" >insertChildrenAt</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => <A HREF="/usr/share/doc/ghc/libraries/ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> a (t b) (t b) -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AinsertChildrenAfter" >insertChildrenAfter</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) (t b) -> a (t b) (t b) -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AinsertTreeTemplate" >insertTreeTemplate</A > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) (t b) -> [<A HREF="Control-Arrow-ArrowIf.html#t%3AIfThen" >IfThen</A > (a (t b) c) (a (t b) (t b))] -> a (t b) (t b)</TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >class</SPAN > <A HREF="#t%3ATree" >Tree</A > t </TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Documentation</TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >class</SPAN > (<A HREF="/usr/share/doc/ghc/libraries/base/Control-Arrow.html#t%3AArrowPlus" >ArrowPlus</A > a, <A HREF="Control-Arrow-ArrowIf.html#t%3AArrowIf" >ArrowIf</A > a) => <A NAME="t:ArrowTree" ><A NAME="t%3AArrowTree" ></A ></A ><B >ArrowTree</B > a <SPAN CLASS="keyword" >where</SPAN ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="ndoc" ><P >The interface for tree arrows </P ><P >all functions have default implementations </P ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="section4" >Methods</TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A NAME="v:mkLeaf" ><A NAME="v%3AmkLeaf" ></A ></A ><B >mkLeaf</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => b -> a c (t b)</TD ></TR ><TR ><TD CLASS="doc" >construct a leaf </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkTree" ><A NAME="v%3AmkTree" ></A ></A ><B >mkTree</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => b -> [t b] -> a c (t b)</TD ></TR ><TR ><TD CLASS="doc" >construct an inner node </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:getChildren" ><A NAME="v%3AgetChildren" ></A ></A ><B >getChildren</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) (t b)</TD ></TR ><TR ><TD CLASS="doc" >select the children of the root of a tree </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:getNode" ><A NAME="v%3AgetNode" ></A ></A ><B >getNode</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) b</TD ></TR ><TR ><TD CLASS="doc" >select the attribute of the root of a tree </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:setChildren" ><A NAME="v%3AsetChildren" ></A ></A ><B >setChildren</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => [t b] -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="doc" >substitute the children of the root of a tree </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:setNode" ><A NAME="v%3AsetNode" ></A ></A ><B >setNode</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => b -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="doc" >substitute the attribute of the root of a tree </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:changeChildren" ><A NAME="v%3AchangeChildren" ></A ></A ><B >changeChildren</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => ([t b] -> [t b]) -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="doc" >edit the children of the root of a tree </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:changeNode" ><A NAME="v%3AchangeNode" ></A ></A ><B >changeNode</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => (b -> b) -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="doc" >edit the attribute of the root of a tree </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:processChildren" ><A NAME="v%3AprocessChildren" ></A ></A ><B >processChildren</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) (t b) -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="doc" ><P >apply an arrow element wise to all children of the root of a tree collect these results and substitute the children with this result </P ><P >example: <TT > processChildren isText </TT > deletes all subtrees, for which isText does not hold </P ><P >example: <TT > processChildren (none `when` isCmt) </TT > removes all children, for which isCmt holds </P ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:replaceChildren" ><A NAME="v%3AreplaceChildren" ></A ></A ><B >replaceChildren</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) (t b) -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="doc" ><P >similar to processChildren, but the new children are computed by processing the whole input tree </P ><P >example: <TT > replaceChildren (deep isText) </TT > selects all subtrees for which isText holds and substitutes the children component of the root node with this list </P ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:/>" ><A NAME="v%3A%2F%3E" ></A ></A ><B >(/>)</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a b (t c) -> a (t c) d -> a b d</TD ></TR ><TR ><TD CLASS="doc" ><P >pronounced "slash", meaning g inside f </P ><P >defined as <TT > f /> g = f >>> getChildren >>> g </TT > </P ><P >example: <TT > hasName "html" /> hasName "body" /> hasName "h1" </TT > </P ><P >This expression selects all "h1" elements in the "body" element of an "html" element, an expression, that corresponds 1-1 to the XPath selection path "html/body/h1" </P ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v://>" ><A NAME="v%3A%2F%2F%3E" ></A ></A ><B >(//>)</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a b (t c) -> a (t c) d -> a b d</TD ></TR ><TR ><TD CLASS="doc" ><P >pronounced "double slash", meaning g arbitrarily deep inside f </P ><P >defined as <TT > f //> g = f >>> getChildren >>> deep g </TT > </P ><P >example: <TT > hasName "html" //> hasName "table" </TT > </P ><P >This expression selects all top level "table" elements within an "html" element, an expression. Attantion: This does not correspond to the XPath selection path "html//table". The latter on matches all table elements even nested ones, but <TT >//></TT > gives in many cases the appropriate functionality. </P ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:</" ><A NAME="v%3A%3C%2F" ></A ></A ><B >(</)</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) (t b) -> a (t b) (t b) -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="doc" ><P >pronounced "outside" meaning f containing g </P ><P >defined as <TT > f </ g = f `containing` (getChildren >>> g) </TT > </P ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:deep" ><A NAME="v%3Adeep" ></A ></A ><B >deep</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) c -> a (t b) c</TD ></TR ><TR ><TD CLASS="doc" ><P >recursively searches a whole tree for subtrees, for which a predicate holds. The search is performed top down. When a tree is found, this becomes an element of the result list. The tree found is not further examined for any subtress, for which the predicate also could hold. See <TT ><A HREF="Control-Arrow-ArrowTree.html#v%3Amulti" >multi</A ></TT > for this kind of search. </P ><P >example: <TT > deep isHtmlTable </TT > selects all top level table elements in a document (with an appropriate definition for isHtmlTable) but no tables occuring within a table cell. </P ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:deepest" ><A NAME="v%3Adeepest" ></A ></A ><B >deepest</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) c -> a (t b) c</TD ></TR ><TR ><TD CLASS="doc" ><P >recursively searches a whole tree for subrees, for which a predicate holds. The search is performed bottom up. </P ><P >example: <TT > deepest isHtmlTable </TT > selects all innermost table elements in a document but no table elements containing tables. See <TT ><A HREF="Control-Arrow-ArrowTree.html#v%3Adeep" >deep</A ></TT > and <TT ><A HREF="Control-Arrow-ArrowTree.html#v%3Amulti" >multi</A ></TT > for other search strategies. </P ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:multi" ><A NAME="v%3Amulti" ></A ></A ><B >multi</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) c -> a (t b) c</TD ></TR ><TR ><TD CLASS="doc" ><P >recursively searches a whole tree for subtrees, for which a predicate holds. The search is performed top down. All nodes of the tree are searched, even within the subtrees of trees for which the predicate holds. </P ><P >example: <TT > multy isHtmlTable </TT > selects all table elements, even nested ones. </P ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:processBottomUp" ><A NAME="v%3AprocessBottomUp" ></A ></A ><B >processBottomUp</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) (t b) -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="doc" ><P >recursively transforms a whole tree by applying an arrow to all subtrees, this is done bottom up depth first, leaves first, root as last tree </P ><P >example: <TT > processBottomUp (getChildren `when` isHtmlFont) </TT > removes all font tags in a HTML document, even nested ones (with an appropriate definition of isHtmlFont) </P ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:processTopDown" ><A NAME="v%3AprocessTopDown" ></A ></A ><B >processTopDown</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) (t b) -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="doc" >similar to <TT ><A HREF="Control-Arrow-ArrowTree.html#v%3AprocessBottomUp" >processBottomUp</A ></TT >, but recursively transforms a whole tree by applying an arrow to all subtrees with a top down depth first traversal strategie. In many cases <TT ><A HREF="Control-Arrow-ArrowTree.html#v%3AprocessBottomUp" >processBottomUp</A ></TT > and <TT ><A HREF="Control-Arrow-ArrowTree.html#v%3AprocessTopDown" >processTopDown</A ></TT > give same results. </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:processBottomUpWhenNot" ><A NAME="v%3AprocessBottomUpWhenNot" ></A ></A ><B >processBottomUpWhenNot</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) (t b) -> a (t b) (t b) -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="doc" >recursively transforms a whole tree by applying an arrow to all subtrees, but transformation stops when a predicte does not hold for a subtree, leaves are transformed first </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:processTopDownUntil" ><A NAME="v%3AprocessTopDownUntil" ></A ></A ><B >processTopDownUntil</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) (t b) -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="doc" ><P >recursively transforms a whole tree by applying an arrow to all subtrees, but transformation stops when a tree is successfully transformed. the transformation is done top down </P ><P >example: <TT > processTopDownUntil (isHtmlTable `guards` tranformTable) </TT > transforms all top level table elements into something else, but inner tables remain unchanged </P ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:insertChildrenAt" ><A NAME="v%3AinsertChildrenAt" ></A ></A ><B >insertChildrenAt</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => <A HREF="/usr/share/doc/ghc/libraries/ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> a (t b) (t b) -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="doc" ><P >computes a list of trees by applying an arrow to the input and inserts this list in front of index i in the list of children </P ><P >example: <TT > insertChildrenAt 0 (deep isCmt) </TT > selects all subtrees for which isCmt holds and copies theses in front of the existing children </P ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:insertChildrenAfter" ><A NAME="v%3AinsertChildrenAfter" ></A ></A ><B >insertChildrenAfter</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) (t b) -> a (t b) (t b) -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="doc" >similar to <TT ><A HREF="Control-Arrow-ArrowTree.html#v%3AinsertChildrenAt" >insertChildrenAt</A ></TT >, but the insertion position is searched with a predicate </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:insertTreeTemplate" ><A NAME="v%3AinsertTreeTemplate" ></A ></A ><B >insertTreeTemplate</B > :: <A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > t => a (t b) (t b) -> [<A HREF="Control-Arrow-ArrowIf.html#t%3AIfThen" >IfThen</A > (a (t b) c) (a (t b) (t b))] -> a (t b) (t b)</TD ></TR ><TR ><TD CLASS="doc" ><P >an arrow for inserting a whole subtree with some holes in it (a template) into a document. The holes can be filled with contents from the input. </P ><P >Example </P ><PRE > insertTreeTemplateTest :: ArrowXml a => a b XmlTree insertTreeTemplateTest = doc >>> insertTemplate template pattern where doc -- the input data = constA "<x><y>The Title</y><z>The content</z></x>" >>> xread template -- the output template with 2 holes: xxx and yyy = constA "<html><head><title>xxx</title></head><body><h1>yyy</h1></body></html>" >>> xread pattern = [ hasText (== "xxx") -- fill the xxx hole with the input contents from element "x/y" :-> ( getChildren >>> hasName "y" >>> deep isText ) , hasText (== "yyy") -- fill the yyy hole with the input contents from element "x/z" :-> ( getChildren >>> hasName "z" >>> getChildren ) ] </PRE ><P >computes the XML tree for the following document </P ><PRE > "<html><head><title>The Title</title></head><body><h1>The content</h1></body></html>" </PRE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="section4" ><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:ArrowTree')" ALT="show/hide" > Instances</TD ></TR ><TR ><TD CLASS="body" ><DIV ID="i:ArrowTree" STYLE="display:block;" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="Control-Arrow-ArrowTree.html#t%3AArrowTree" >ArrowTree</A > <A HREF="Control-Arrow-ListArrow.html#t%3ALA" >LA</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Control-Arrow-ArrowTree.html#t%3AArrowTree" >ArrowTree</A > <A HREF="Control-Arrow-IOListArrow.html#t%3AIOLA" >IOLA</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Control-Arrow-ArrowTree.html#t%3AArrowTree" >ArrowTree</A > (<A HREF="Control-Arrow-StateListArrow.html#t%3ASLA" >SLA</A > s)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Control-Arrow-ArrowTree.html#t%3AArrowTree" >ArrowTree</A > (<A HREF="Control-Arrow-IOStateListArrow.html#t%3AIOSLA" >IOSLA</A > s)</TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >class</SPAN > <A NAME="t:Tree" ><A NAME="t%3ATree" ></A ></A ><B >Tree</B > t </TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="ndoc" >The interface for trees </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="section4" ><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Tree')" ALT="show/hide" > Instances</TD ></TR ><TR ><TD CLASS="body" ><DIV ID="i:Tree" STYLE="display:block;" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="Control-Arrow-ArrowTree.html#t%3ATree" >Tree</A > <A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="botbar" >Produced by <A HREF="http://www.haskell.org/haddock/" >Haddock</A > version 2.5.0</TD ></TR ></TABLE ></BODY ></HTML >