<!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 >Data.Tree.NTree.Filter</TITLE ><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" ><SCRIPT SRC="haddock.js" TYPE="text/javascript" ></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-7.1: </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" >Data.Tree.NTree.Filter</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 ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="section4" ><B >Contents</B ></TD ></TR ><TR ><TD ><DL ><DT ><A HREF="#1" >Filter </A ></DT ><DT ><A HREF="#2" >Monadic Filter </A ></DT ></DL ></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: Filter.hs,v 1.6 2006<EM >11</EM >12 14:52:59 hxml Exp $ </P ><P >Filter for n-ary tree structure with filter combinators copied and modified from HxXml (<A HREF="http://www.cs.york.ac.uk/fp/HaXml/" >http://www.cs.york.ac.uk/fp/HaXml/</A >) </P ><P >Similar but more flexible functions for tree processing are defined in the arrow classes <A HREF="Control-Arrow-ArrowList.html" >Control.Arrow.ArrowList</A >, <A HREF="Control-Arrow-ArrowIf.html" >Control.Arrow.ArrowIf</A >, <A HREF="Control-Arrow-ArrowTree.html" >Control.Arrow.ArrowTree</A > and <A HREF="Control-Arrow-ArrowState.html" >Control.Arrow.ArrowState</A >. For new applications, especially for XML processing, it's recommended to use the arrow interface <A HREF="Text-XML-HXT-Arrow.html" >Text.XML.HXT.Arrow</A > instead of this filter approach as part of the api <A HREF="Text-XML-HXT-Parser.html" >Text.XML.HXT.Parser</A > </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" >module <A HREF="Data-Tree-NTree-TypeDefs.html" >Data.Tree.NTree.TypeDefs</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >type</SPAN > <A HREF="#t%3ATFilter" >TFilter</A > node = <A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node -> <A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTrees" >NTrees</A > node</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >type</SPAN > <A HREF="#t%3ATSFilter" >TSFilter</A > node = <A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTrees" >NTrees</A > node -> <A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTrees" >NTrees</A > node</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Asatisfies" >satisfies</A > :: (a -> [b]) -> a -> Bool</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Anone" >none</A > :: a -> [b]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Athis" >this</A > :: a -> [a]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisOf" >isOf</A > :: (a -> Bool) -> a -> [a]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisOfNode" >isOfNode</A > :: (node -> Bool) -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkNTree" >mkNTree</A > :: <A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AreplaceNode" >replaceNode</A > :: node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AreplaceChildren" >replaceChildren</A > :: <A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTrees" >NTrees</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmodifyNode" >modifyNode</A > :: (node -> Maybe node) -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmodifyNode0" >modifyNode0</A > :: (node -> node) -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmodifyChildren" >modifyChildren</A > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATSFilter" >TSFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AsubstChildren" >substChildren</A > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AprocessChildren" >processChildren</A > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Ao" >o</A > :: (a -> [b]) -> (c -> [a]) -> c -> [b]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3A.%3E" >(.>)</A > :: (a -> [b]) -> (b -> [c]) -> a -> [c]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AseqF" >seqF</A > :: [a -> [a]] -> a -> [a]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3A..%3E" >(..>)</A > :: (a -> [b]) -> (a -> b -> [d]) -> a -> [d]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3A%2B%2B%2B" >(+++)</A > :: (a -> [b]) -> (a -> [b]) -> a -> [b]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Acat" >cat</A > :: [a -> [b]] -> a -> [b]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AorElse" >orElse</A > :: (a -> [b]) -> (a -> [b]) -> a -> [b]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Aiff" >iff</A > :: (a -> [c]) -> (a -> [b]) -> (a -> [b]) -> a -> [b]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Achoice" >choice</A > :: [<A HREF="Data-Tree-NTree-Filter.html#t%3AIfThen" >IfThen</A > (a -> [c]) (a -> [b])] -> a -> [b]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A HREF="#t%3AIfThen" >IfThen</A > a b = <A HREF="#v%3A%3A-%3E" >(:->)</A > a b</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Awhen" >when</A > :: (a -> [a]) -> (a -> [a]) -> a -> [a]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AwhenNot" >whenNot</A > :: (a -> [a]) -> (a -> [a]) -> a -> [a]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Aguards" >guards</A > :: (a -> [b]) -> (a -> [b]) -> a -> [b]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Aneg" >neg</A > :: (a -> [c]) -> a -> [a]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Acontaining" >containing</A > :: (a -> [b]) -> (b -> [c]) -> a -> [b]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AnotContaining" >notContaining</A > :: (a -> [b]) -> (b -> [c]) -> a -> [b]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3A%2F%3E" >(/>)</A > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3A%3C%2F" >(</)</A > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Adeep" >deep</A > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Adeepest" >deepest</A > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Amulti" >multi</A > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AprocessBottomUp" >processBottomUp</A > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AprocessBottomUpIfNot" >processBottomUpIfNot</A > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AprocessTopDown" >processTopDown</A > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AprocessTopDownUntil" >processTopDownUntil</A > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AinsertChildrenAt" >insertChildrenAt</A > :: Int -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AinsertChildrenAfter" >insertChildrenAfter</A > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AthisM" >thisM</A > :: Monad m => a -> m [a]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AnoneM" >noneM</A > :: Monad m => a -> m [b]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3A.%3E%3E" >(.>>)</A > :: Monad m => (a -> m [b]) -> (b -> m [c]) -> a -> m [c]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AseqM" >seqM</A > :: Monad m => [a -> m [a]] -> a -> m [a]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3A%2B%2B%2B%3E%3E" >(+++>>)</A > :: Monad m => (a -> m [b]) -> (a -> m [b]) -> a -> m [b]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AcatM" >catM</A > :: Monad m => [a -> m [b]] -> a -> m [b]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AifM" >ifM</A > :: Monad m => (a -> [b]) -> (a -> m [c]) -> (a -> m [c]) -> a -> m [c]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AchoiceM" >choiceM</A > :: Monad m => [<A HREF="Data-Tree-NTree-Filter.html#t%3AIfThen" >IfThen</A > (a -> [c]) (a -> m [b])] -> a -> m [b]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AwhenM" >whenM</A > :: Monad m => (a -> m [a]) -> (a -> [b]) -> a -> m [a]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AwhenNotM" >whenNotM</A > :: Monad m => (a -> m [a]) -> (a -> [b]) -> a -> m [a]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AguardsM" >guardsM</A > :: Monad m => (a -> [b]) -> (a -> m [c]) -> a -> m [c]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AcontainingM" >containingM</A > :: Monad m => (a -> m [b]) -> (b -> [c]) -> a -> m [b]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AprocessChildrenM" >processChildrenM</A > :: Monad m => (<A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node -> m [<A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node]) -> <A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node -> m [<A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AprocessTopDownM" >processTopDownM</A > :: Monad m => (<A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node -> m [<A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node]) -> <A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node -> m [<A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AprocessBottomUpM" >processBottomUpM</A > :: Monad m => (<A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node -> m [<A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node]) -> <A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node -> m [<A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AliftMf" >liftMf</A > :: Monad m => (a -> [b]) -> a -> m [b]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3A%24%24" >($$)</A > :: (a -> [b]) -> [a] -> [b]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3A%24%24%3C" >($$<)</A > :: Monad m => (a -> m [b]) -> [a] -> m [b]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AperformAction" >performAction</A > :: Monad m => (a -> m b) -> a -> m [a]</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" >module <A HREF="Data-Tree-NTree-TypeDefs.html" >Data.Tree.NTree.TypeDefs</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >type</SPAN > <A NAME="t%3ATFilter" ></A ><B >TFilter</B > node = <A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node -> <A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTrees" >NTrees</A > node</TD ></TR ><TR ><TD CLASS="doc" ><P >tree filter type: a function mapping a tree onto a list of trees </P ><P >filter can be used in various ways, as predicates, selectors, transformers, ... </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >type</SPAN > <A NAME="t%3ATSFilter" ></A ><B >TSFilter</B > node = <A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTrees" >NTrees</A > node -> <A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTrees" >NTrees</A > node</TD ></TR ><TR ><TD CLASS="doc" >a filter for sequences </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3Asatisfies" ></A ><B >satisfies</B > :: (a -> [b]) -> a -> Bool</TD ></TR ><TR ><TD CLASS="doc" ><P >satisfies converts a result of a predicate filter into a boolean </P ><P >is a shortcut for not . null </P ><P >typical use in guards or ifs: <TT >if (satisfies f) t then ... else ... </TT > </P ><UL ><LI > 1.parameter f : the predicate filter </LI ><LI > 2.parameter t : the tree to be tested </LI ><LI > returns : <TT >b = not (null (f t))</TT > </LI ></UL ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="1" >Filter </A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3Anone" ></A ><B >none</B > :: a -> [b]</TD ></TR ><TR ><TD CLASS="doc" >the null filter, returns the empty list </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3Athis" ></A ><B >this</B > :: a -> [a]</TD ></TR ><TR ><TD CLASS="doc" >the unit filter, returns the single element list containing the argument </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AisOf" ></A ><B >isOf</B > :: (a -> Bool) -> a -> [a]</TD ></TR ><TR ><TD CLASS="doc" ><P >conversion from predicate function to filter </P ><UL ><LI > 1.parameter p : the predicate for testing the tree </LI ><LI > returns : <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Athis" >this</A ></TT > or <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Anone" >none</A ></TT > depending on the predicate </LI ></UL ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AisOfNode" ></A ><B >isOfNode</B > :: (node -> Bool) -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="doc" ><P >select filter, selects trees with node values with a specific property </P ><UL ><LI > 1.parameter p : the predicate for testing the node value </LI ><LI > returns : <TT >[]</TT > or <TT >[t]</TT > depending on <TT >p t</TT > </LI ></UL ><P >a special case of <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AisOf" >isOf</A ></TT > filter </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AmkNTree" ></A ><B >mkNTree</B > :: <A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="doc" ><P >filter for substituting an arbitray tree by a constant </P ><UL ><LI > 1.parameter t : the result tree, the input tree is ignored </LI ><LI > returns : the filter </LI ></UL ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AreplaceNode" ></A ><B >replaceNode</B > :: node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="doc" ><P >filter for replacing the node </P ><UL ><LI > 1.parameter n : the new node </LI ><LI > returns : the editing filter </LI ></UL ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AreplaceChildren" ></A ><B >replaceChildren</B > :: <A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTrees" >NTrees</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="doc" ><P >filter for replacing the children </P ><UL ><LI > 1.parameter cs : cs the list of children </LI ><LI > returns : the filter </LI ></UL ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AmodifyNode" ></A ><B >modifyNode</B > :: (node -> Maybe node) -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AmodifyNode0" ></A ><B >modifyNode0</B > :: (node -> node) -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="doc" ><P >filter for editing the node </P ><UL ><LI > 1.parameter nf : the XNode editing funtion </LI ><LI > returns : the filter </LI ></UL ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AmodifyChildren" ></A ><B >modifyChildren</B > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATSFilter" >TSFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="doc" ><P >filter for editing the children </P ><P >all children are processed with a filter mapping lists to lists, this enables not only elementwise editing by lifting a normal filter to a list filter with <TT >(f $$)</TT > (see '($$)') but also manipulation of the order of the elements, e.g. <A HREF="reverse.html" >reverse</A > is an appropriate childen editing function. </P ><UL ><LI > 1.parameter csf : the children editing function </LI ><LI > returns : the filter </LI ></UL ><P >see also : <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AprocessChildren" >processChildren</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AsubstChildren" ></A ><B >substChildren</B > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="doc" >filter for substituting the children of a tree by a new list of childen computed by applying a filter to the input tree. <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AmodifyChildren" >modifyChildren</A ></TT > can be expressed by <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AsubstChildren" >substChildren</A ></TT >: <TT >modifyChildren f t</TT > is equal to <TT >substChildren (f . getChildren)</TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AprocessChildren" ></A ><B >processChildren</B > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="doc" ><P >Filter for editing the children of a tree element wise </P ><UL ><LI > 1.parameter cf : the filter applied to the children </LI ><LI > returns : the editing filter </LI ></UL ><P >see also : <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AmodifyChildren" >modifyChildren</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3Ao" ></A ><B >o</B > :: (a -> [b]) -> (c -> [a]) -> c -> [b]</TD ></TR ><TR ><TD CLASS="doc" ><P >sequential composition of filters, usually written in infix notation f2 <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Ao" >o</A ></TT > f1. </P ><P >for predicate filter the logical AND </P ><UL ><LI > 1.parameter f2 : the 2. filter </LI ><LI > 2.parameter f1 : the 1. filter </LI ><LI > returns : the fiter applying first f1 to n and then f2 to the result (like function composition) </LI ></UL ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3A.%3E" ></A ><B >(.>)</B > :: (a -> [b]) -> (b -> [c]) -> a -> [c]</TD ></TR ><TR ><TD CLASS="doc" ><P >pronounced "followed by", defined as: <TT >f .> g = g `o` f</TT >. </P ><P >allows filter composition in a more readable way from left to right </P ><UL ><LI > 1.parameter f1 : the 1. filter </LI ><LI > 2.parameter f2 : the 2. filter </LI ><LI > returns : the composition of f1 and f2 </LI ></UL ><P >see also : <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Ao" >o</A ></TT >, '(..>)' </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AseqF" ></A ><B >seqF</B > :: [a -> [a]] -> a -> [a]</TD ></TR ><TR ><TD CLASS="doc" ><P >apply a list of filters sequentially with '(.>)', for predicate filters the generalized AND </P ><P >see also : '(.>)' </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3A..%3E" ></A ><B >(..>)</B > :: (a -> [b]) -> (a -> b -> [d]) -> a -> [d]</TD ></TR ><TR ><TD CLASS="doc" ><P >special sequential composition. </P ><P >filter f is applied to an argument t. then filter g is applied to all elements of the result list, but the argument t is also passed as extra parameter to g. </P ><P >This allows for step by step transformations of a tree with access to the original tree in every transformation step. </P ><P >see also : '(.>)', <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Ao" >o</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3A%2B%2B%2B" ></A ><B >(+++)</B > :: (a -> [b]) -> (a -> [b]) -> a -> [b]</TD ></TR ><TR ><TD CLASS="doc" ><P >binary parallel composition, the logical OR for predicate filter </P ><UL ><LI > 1.parameter f1 : the 1. filter </LI ><LI > 2.parameter f2 : the 2. filter </LI ><LI > returns : the filter for applying f1 and f2 both to an argument tree and concatenating the results </LI ></UL ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3Acat" ></A ><B >cat</B > :: [a -> [b]] -> a -> [b]</TD ></TR ><TR ><TD CLASS="doc" ><P >apply a list of filters, a "union" for lists, for predicate filters the generalized OR </P ><UL ><LI > 1.parameter fs : the list of filters </LI ><LI > returns : the composing filter </LI ></UL ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AorElse" ></A ><B >orElse</B > :: (a -> [b]) -> (a -> [b]) -> a -> [b]</TD ></TR ><TR ><TD CLASS="doc" ><P >directional choice, usually written in infix notation as f <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AorElse" >orElse</A ></TT > g </P ><UL ><LI > 1.parameter f : the 1. filter </LI ><LI > 2.parameter g : the 2. filter </LI ><LI > 3.parameter t : the tree </LI ><LI > returns : the filter, that applies f to t, if the result is not the empty list, the result is found, else g t is the result </LI ></UL ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3Aiff" ></A ><B >iff</B > :: (a -> [c]) -> (a -> [b]) -> (a -> [b]) -> a -> [b]</TD ></TR ><TR ><TD CLASS="doc" ><P >if then else lifted to filters </P ><UL ><LI > 1.parameter p : the predicate filter </LI ><LI > 2.parameter t : the "then" filter </LI ><LI > 3.parameter e : the "else" filter </LI ><LI > returns : the resulting conditional filter </LI ></UL ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3Achoice" ></A ><B >choice</B > :: [<A HREF="Data-Tree-NTree-Filter.html#t%3AIfThen" >IfThen</A > (a -> [c]) (a -> [b])] -> a -> [b]</TD ></TR ><TR ><TD CLASS="doc" ><P >multiway branch. The list of cases <TT >f :-> g</TT > is processed sequentially, in the first case for that f holds g is applied, if no case matches, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Anone" >none</A ></TT > is applied. This filter can be used like a case expression: <TT >choice [ p1 :-> f1, p2 :-> f2, ... , this :-> defaultFilter]</TT > </P ><P >see also : <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Aiff" >iff</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AchoiceM" >choiceM</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A NAME="t%3AIfThen" ></A ><B >IfThen</B > a b</TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="ndoc" >auxiliary datatype for cases within choice filter </TD ></TR ><TR ><TD CLASS="section4" >Constructors</TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="arg" ><A NAME="v%3A%3A-%3E" ></A ><B >(:->)</B > a b</TD ><TD CLASS="rdoc" ></TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3Awhen" ></A ><B >when</B > :: (a -> [a]) -> (a -> [a]) -> a -> [a]</TD ></TR ><TR ><TD CLASS="doc" ><P >when the predicate p holds, f is applied, else the identity filter this </P ><UL ><LI > 1.parameter f : the conditinally applied filter </LI ><LI > 2.parameter p : the predicate </LI ><LI > returns : the conditional filter </LI ></UL ><P >see also : <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Aiff" >iff</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AwhenNot" >whenNot</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Aguards" >guards</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AwhenM" >whenM</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AwhenNot" ></A ><B >whenNot</B > :: (a -> [a]) -> (a -> [a]) -> a -> [a]</TD ></TR ><TR ><TD CLASS="doc" ><P >the complementary filter of when </P ><P >shortcut for f <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Awhen" >when</A ></TT > neg g </P ><P >see also : <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Aiff" >iff</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Awhen" >when</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AwhenNotM" >whenNotM</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Aneg" >neg</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3Aguards" ></A ><B >guards</B > :: (a -> [b]) -> (a -> [b]) -> a -> [b]</TD ></TR ><TR ><TD CLASS="doc" ><P >when the predicate p holds, f is applied, else the null filter none </P ><UL ><LI > 1.parameter p : the predicate filter </LI ><LI > 2.parameter f : the conditionally applied filter </LI ><LI > returns : the conditional filter </LI ></UL ><P >see also : <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Aiff" >iff</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Awhen" >when</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AguardsM" >guardsM</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3Aneg" ></A ><B >neg</B > :: (a -> [c]) -> a -> [a]</TD ></TR ><TR ><TD CLASS="doc" ><P >negation lifted to filters </P ><UL ><LI > 1.parameter f : the predicate filter </LI ><LI > returns : the filter, that succeeds, when f failed </LI ></UL ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3Acontaining" ></A ><B >containing</B > :: (a -> [b]) -> (b -> [c]) -> a -> [b]</TD ></TR ><TR ><TD CLASS="doc" ><P >pruning: keep only those results from f for which g holds, usually written in infix notation as f <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Acontaining" >containing</A ></TT > g </P ><UL ><LI > 1.parameter f : the processing filter </LI ><LI > 2.parameter g : the predicate filter </LI ><LI > 3.parameter t : the tree </LI ><LI > returns : all trees r from f t, for which g r holds (is not the empty list) </LI ></UL ><P >see also : <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AnotContaining" >notContaining</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AnotContaining" ></A ><B >notContaining</B > :: (a -> [b]) -> (b -> [c]) -> a -> [b]</TD ></TR ><TR ><TD CLASS="doc" ><P >pruning: keep only those results from f for which g does not hold </P ><P >see also : <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Acontaining" >containing</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3A%2F%3E" ></A ><B >(/>)</B > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="doc" >pronounced "slash", meaning g inside f </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3A%3C%2F" ></A ><B >(</)</B > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="doc" >pronounced "outside" meaning f containing g </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3Adeep" ></A ><B >deep</B > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="doc" ><P >top down search. </P ><P >search terminates, when filter f succeeds can e.g. be used for finding all outermost tag node of a specific kind </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3Adeepest" ></A ><B >deepest</B > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="doc" ><P >bottom up search. </P ><P >first the children are processed, if this does not succeed, the node itself is processed can e.g. be used for finding all innermost tag nodes of a specific kind </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3Amulti" ></A ><B >multi</B > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="doc" ><P >process all nodes of the whole tree. </P ><P >can e.g. be used for finding all nodes of a specific kind </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AprocessBottomUp" ></A ><B >processBottomUp</B > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="doc" ><P >bottom up transformation </P ><UL ><LI > 1.parameter f : the <EM >simple</EM > transforming filter </LI ><LI > returns : the filter that applies f to all subtrees and the tree itself in a deepth first left to right manner </LI ></UL ><P >see also : <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AprocessTopDown" >processTopDown</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AprocessBottomUpIfNot" >processBottomUpIfNot</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AprocessBottomUpIfNot" ></A ><B >processBottomUpIfNot</B > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="doc" ><P >guarded bottom up transformation, stops at subtrees for which a predicate p holds </P ><UL ><LI > 1.parameter f : the transforming filter </LI ><LI > 2.parameter p : the predicate filter for the guard </LI ><LI > returns : the filter for processing all (sub-)trees </LI ></UL ><P >see also : <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AprocessBottomUp" >processBottomUp</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AprocessTopDown" ></A ><B >processTopDown</B > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="doc" ><P >top down transformation </P ><UL ><LI > 1.parameter f : the <EM >simple</EM > transforming filter </LI ><LI > returns : the filter that applies f first to the tree and then recursively to all subtrees of the result </LI ></UL ><P >see also : <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AprocessBottomUp" >processBottomUp</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AprocessTopDownUntil" ></A ><B >processTopDownUntil</B > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="doc" ><P >top down transformation until a node to be transformed is found </P ><UL ><LI > 1.parameter f : the <EM >simple</EM > transforming filter </LI ><LI > returns : the filter that applies f first to the tree and, if the filter does not succeed, recursively to all children of the input tree. </LI ></UL ><P >Example: </P ><PRE >processTopDownUntil none</PRE ><P >is the identity filter (maybe a bit more inefficient). </P ><P >Example: </P ><PRE >processTopDownUntil (add1Attr "border" "2" `containing` isTag "table")</PRE ><P >is a filter for adding an attribute border="2" in all top level table tags. The content of table tags will remain unchanged. </P ><P >see also : <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AprocessTopDown" >processTopDown</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AprocessBottomUp" >processBottomUp</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AinsertChildrenAt" ></A ><B >insertChildrenAt</B > :: Int -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="doc" ><P >insertion of trees into the list of children at a given position </P ><P >useful for inserting something into the list of children at a given position the list of children is split with the <TT >splitAt</TT > function the nodes are inserted between these two sublists. </P ><P >examples: <TT >insertChildrenAt 0 ins t</TT > inserts all elements computed with <TT >ins t</TT > in front of the childen of <TT >t</TT >, <TT >insertChildrenAt 1 ins t</TT > behind the first child </P ><P >see also: <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AinsertChildrenAfter" >insertChildrenAfter</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AinsertChildrenAfter" ></A ><B >insertChildrenAfter</B > :: <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node -> <A HREF="Data-Tree-NTree-Filter.html#t%3ATFilter" >TFilter</A > node</TD ></TR ><TR ><TD CLASS="doc" ><P >insertion of trees into the list of children after specific elements </P ><P >useful for inserting something into the list of children of a node the list of children is split with the <TT >span</TT > function and the filter p as predicate the nodes are inserted between these two sublists </P ><P >examples: <TT >insertChildrenAfter none ins t</TT > inserts all elements computed with <TT >ins t</TT > in front of the childen of <TT >t</TT >, <TT >insertChildrenAfter this ins t</TT > appends the elements to the children </P ><P >see also: <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AinsertChildrenAt" >insertChildrenAt</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="2" >Monadic Filter </A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AthisM" ></A ><B >thisM</B > :: Monad m => a -> m [a]</TD ></TR ><TR ><TD CLASS="doc" ><P >the monadic version of the identity filter this. </P ><P >see also : <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Athis" >this</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AnoneM" ></A ><B >noneM</B > :: Monad m => a -> m [b]</TD ></TR ><TR ><TD CLASS="doc" ><P >the monadic version of the null filter none. </P ><P >see also : <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Anone" >none</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3A.%3E%3E" ></A ><B >(.>>)</B > :: Monad m => (a -> m [b]) -> (b -> m [c]) -> a -> m [c]</TD ></TR ><TR ><TD CLASS="doc" ><P >sequential composition of monadic filters, monadic version of ".>". </P ><UL ><LI > 1.parameter f1 : the 1. monadic filter </LI ><LI > 2.parameter f2 : the 2. monadic filter </LI ><LI > returns : the monadic fiter applying first f1 to n and then f2 to the result (like function composition) </LI ></UL ><P >see also : '(.>)' </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AseqM" ></A ><B >seqM</B > :: Monad m => [a -> m [a]] -> a -> m [a]</TD ></TR ><TR ><TD CLASS="doc" >generalized sequential composition of monadic filters </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3A%2B%2B%2B%3E%3E" ></A ><B >(+++>>)</B > :: Monad m => (a -> m [b]) -> (a -> m [b]) -> a -> m [b]</TD ></TR ><TR ><TD CLASS="doc" ><P >binary parallel composition, the logical OR for predicate filter </P ><UL ><LI > 1.parameter f1 : the 1. filter </LI ><LI > 2.parameter f2 : the 2. filter </LI ><LI > returns : the filter for applying f1 and f2 both to an argument tree and concatenating the results see also: <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Acat" >cat</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3A%2B%2B%2B" >+++</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AcatM" >catM</A ></TT > </LI ></UL ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AcatM" ></A ><B >catM</B > :: Monad m => [a -> m [b]] -> a -> m [b]</TD ></TR ><TR ><TD CLASS="doc" ><P >apply a list of monadic filters </P ><UL ><LI > 1.parameter fs : the list of filters </LI ><LI > returns : the composing filter see also: <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Acat" >cat</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3A%2B%2B%2B" >+++</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3A%2B%2B%2B%3E%3E" >+++>></A ></TT > </LI ></UL ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AifM" ></A ><B >ifM</B > :: Monad m => (a -> [b]) -> (a -> m [c]) -> (a -> m [c]) -> a -> m [c]</TD ></TR ><TR ><TD CLASS="doc" ><P >monadic if-then-else. </P ><UL ><LI > 1.parameter p : the predicate </LI ><LI > 2.parameter thenP : the then part: the monadic filter, that is applied if p holds for the input tree </LI ><LI > 3.parameter elseP : the else part </LI ><LI > returns : the monadic filter for the conditional </LI ></UL ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AchoiceM" ></A ><B >choiceM</B > :: Monad m => [<A HREF="Data-Tree-NTree-Filter.html#t%3AIfThen" >IfThen</A > (a -> [c]) (a -> m [b])] -> a -> m [b]</TD ></TR ><TR ><TD CLASS="doc" ><P >monadic version of multiway branch. The list of cases <TT >f :-> g</TT > is processed sequentially, in the first case for that f holds g is applied, if no case matches, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AnoneM" >noneM</A ></TT > is applied. This filter can be used like a case expression: <TT >choiceM [ p1 :-> f1, p2 :-> f2, ... , thisM :-> defaultFilter]</TT > </P ><P >see also : <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Achoice" >choice</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AifM" >ifM</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AwhenM" ></A ><B >whenM</B > :: Monad m => (a -> m [a]) -> (a -> [b]) -> a -> m [a]</TD ></TR ><TR ><TD CLASS="doc" ><P >when the predicate p holds, the monadic filter f is applied, else the identity filter. </P ><UL ><LI > 1.parameter f : the conditinally applied monadic filter </LI ><LI > 2.parameter p : the simple predicate </LI ><LI > returns : the conditional filter </LI ></UL ><P >see also : <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AifM" >ifM</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Awhen" >when</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AguardsM" >guardsM</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AwhenNotM" >whenNotM</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AwhenNotM" ></A ><B >whenNotM</B > :: Monad m => (a -> m [a]) -> (a -> [b]) -> a -> m [a]</TD ></TR ><TR ><TD CLASS="doc" ><P >the complementary filter of whenM. </P ><P >see also : <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AifM" >ifM</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AwhenM" >whenM</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AwhenNot" >whenNot</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AguardsM" ></A ><B >guardsM</B > :: Monad m => (a -> [b]) -> (a -> m [c]) -> a -> m [c]</TD ></TR ><TR ><TD CLASS="doc" ><P >when the predicate p holds, the monadic filter f is applied, else the null filter. </P ><UL ><LI > 1.parameter p : the simple predicate filter </LI ><LI > 2.parameter f : the conditionally applied monadic filter </LI ><LI > returns : the conditional filter </LI ></UL ><P >see also : <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AifM" >ifM</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3Aguards" >guards</A ></TT >, <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AwhenM" >whenM</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AcontainingM" ></A ><B >containingM</B > :: Monad m => (a -> m [b]) -> (b -> [c]) -> a -> m [b]</TD ></TR ><TR ><TD CLASS="doc" ><P >pruning: monadic version of containing, usually written in infix notation as f <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AcontainingM" >containingM</A ></TT > g </P ><UL ><LI > 1.parameter f : the monadic processing filter </LI ><LI > 2.parameter g : the predicate filter </LI ><LI > 3.parameter t : the tree </LI ><LI > returns : all trees r from f t, for which g r holds (is not the empty list) </LI ></UL ><P >see also : <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AnotContaining" >notContaining</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AprocessChildrenM" ></A ><B >processChildrenM</B > :: Monad m => (<A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node -> m [<A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node]) -> <A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node -> m [<A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node]</TD ></TR ><TR ><TD CLASS="doc" ><P >Filter for editing the children of a tree with a monadic filter </P ><UL ><LI > 1.parameter cf : the monadic filter applied to the children </LI ><LI > returns : the monadic editing filter </LI ></UL ><P >see also : <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AprocessChildren" >processChildren</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AprocessTopDownM" ></A ><B >processTopDownM</B > :: Monad m => (<A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node -> m [<A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node]) -> <A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node -> m [<A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node]</TD ></TR ><TR ><TD CLASS="doc" >monadic variant of <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AprocessTopDown" >processTopDown</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AprocessBottomUpM" ></A ><B >processBottomUpM</B > :: Monad m => (<A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node -> m [<A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node]) -> <A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node -> m [<A HREF="Data-Tree-NTree-TypeDefs.html#t%3ANTree" >NTree</A > node]</TD ></TR ><TR ><TD CLASS="doc" >monadic variant of <TT ><A HREF="Data-Tree-NTree-Filter.html#v%3AprocessBottomUp" >processBottomUp</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AliftMf" ></A ><B >liftMf</B > :: Monad m => (a -> [b]) -> a -> m [b]</TD ></TR ><TR ><TD CLASS="doc" ><P >lift a filter to a monadic filter </P ><UL ><LI > 1.parameter f : the <EM >simple</EM > filter </LI ><LI > returns : the lifted monadic version </LI ></UL ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3A%24%24" ></A ><B >($$)</B > :: (a -> [b]) -> [a] -> [b]</TD ></TR ><TR ><TD CLASS="doc" ><P >infix operator for applying a filter to a list of trees </P ><UL ><LI > 1.parameter f : the filter </LI ><LI > 2.parameter ts : the list of trees </LI ><LI > returns : the concatenated list of results </LI ></UL ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3A%24%24%3C" ></A ><B >($$<)</B > :: Monad m => (a -> m [b]) -> [a] -> m [b]</TD ></TR ><TR ><TD CLASS="doc" ><P >infix operator for applying a monadic filter to a list of trees, typically used in do-notation for processing of intermediate results. </P ><UL ><LI > 1.parameter f : the monadic filter </LI ><LI > 2.parameter ts : the list of trees </LI ><LI > returns : the concatenated list of results </LI ></UL ><P >see also : '($$)' </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v%3AperformAction" ></A ><B >performAction</B > :: Monad m => (a -> m b) -> a -> m [a]</TD ></TR ><TR ><TD CLASS="doc" ><P >run an arbitray command on a tree t and return the tree, used for inserting arbitray commands in a filter pipeline </P ><UL ><LI > 1.parameter cmd : the command </LI ><LI > 2.parameter t : the argument tree </LI ><LI > returns : the unchanged tree as a single element list </LI ></UL ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="botbar" >Produced by <A HREF="http://www.haskell.org/haddock/" >Haddock</A > version 0.8</TD ></TR ></TABLE ></BODY ></HTML >