úÎp•l"      !None-2468=BCEHKMT is a custom version of "4, created so that users could still have their own " accessible within conditionals.S and its related combinators form a DSL to express whether, given an item of type aË: that item passes the predicate, and/or if recursion should be performed from that item, should it relate to the branch of a tree. This is used to build predicates that can guide recursive traversals.YFor example, when recursing files in a directory tree, there are several scenarios that  maybe consider:gWhether the entry at a given path is of interest, independent from its type (files or directories)EIf the path is a directory, if the directory should be recursed into.’Yes or no answers are accepted for either criterion. This means that the answer is "no" to both questions for a given directory, the combinator ] should be used both to ignore the entry itself, and to prevent recursion into its contents.5Several different predicate types may be promoted to : BoolUsing #m BoolUsing   a -> BoolUsing   a -> m BoolUsing a -> m (Maybe r)Using a -> m (Maybe (r, a))Using Here is a trivial example: †flip runCondT 42 $ do guard_ even liftIO $ putStrLn "42 must be even to reach here" guard_ odd <|> guard_ even guard_ (== 42) If  is executed using , it returns a Maybe r: if the predicate matched. It should usually be run with  applyCondTN, which calls a continuation indicating wether recursion should be performed.tApply a condition to an input value, returning a (possibly) updated copy of that value if it matches, and the next 4 to use if recursion into that value was indicated. A specialized variant of # that simply returns True or False.1let good = guard_ (== "foo.hs") :: Cond String ()1let bad = guard_ (== "foo.hi") :: Cond String ():runIdentity $ test "foo.hs" $ not_ bad >> return "Success"TrueHrunIdentity $ test "foo.hs" $ not_ good >> return "Shouldn't reach here"FalseKApply a value-returning predicate. Note that whether or not this return a $H value, recursion will be performed in the entry itself, if applicable.Consider an element, as t, but returning a mutated form of the element. This can be used to apply optimizations to speed future conditions._ ignores the current entry, but allows recursion into its descendents. This is the same as %.b prevents recursion into the current entry's descendents, but does not ignore the entry itself.S is a synonym for both ignoring an entry and its descendents. It is the same as ignore >> norecurse.¦Return True or False depending on whether the given condition matches or not. This differs from simply stating the condition in that it itself always succeeds.<runCond "foo.hs" $ matches (guard =<< queries (== "foo.hs")) Just True<runCond "foo.hs" $ matches (guard =<< queries (== "foo.hi")) Just FalseWA variant of ifM which branches on whether the condition succeeds or not. Note that if_ x is equivalent to ifM (matches x),, and is provided solely for convenience.1let good = guard_ (== "foo.hs") :: Cond String ()1let bad = guard_ (== "foo.hi") :: Cond String ()ArunCond "foo.hs" $ if_ good (return "Success") (return "Failure")Just "Success"@runCond "foo.hs" $ if_ bad (return "Success") (return "Failure")Just "Failure" is just like &a, except that it executes the body if the condition passes, rather than based on a Bool value.1let good = guard_ (== "foo.hs") :: Cond String ()1let bad = guard_ (== "foo.hi") :: Cond String ()$runCond "foo.hs" $ when_ good ignoreNothing#runCond "foo.hs" $ when_ bad ignoreJust () is just like &`, except that it executes the body if the condition fails, rather than based on a Bool value.1let good = guard_ (== "foo.hs") :: Cond String ()1let bad = guard_ (== "foo.hi") :: Cond String ()%runCond "foo.hs" $ unless_ bad ignoreNothing&runCond "foo.hs" $ unless_ good ignoreJust ()VCheck whether at least one of the given conditions is true. This is a synonym for '.1let good = guard_ (== "foo.hs") :: Cond String ()1let bad = guard_ (== "foo.hi") :: Cond String ()"runCond "foo.hs" $ or_ [bad, good]Just ()runCond "foo.hs" $ or_ [bad]NothingKCheck that all of the given conditions are true. This is a synonym for (.1let good = guard_ (== "foo.hs") :: Cond String ()1let bad = guard_ (== "foo.hi") :: Cond String ()#runCond "foo.hs" $ and_ [bad, good]NothingrunCond "foo.hs" $ and_ [good]Just (), inverts the meaning of the given predicate.1let good = guard_ (== "foo.hs") :: Cond String ()1let bad = guard_ (== "foo.hi") :: Cond String ()/runCond "foo.hs" $ not_ bad >> return "Success"Just "Success"=runCond "foo.hs" $ not_ good >> return "Shouldn't reach here"Nothing} changes the recursion predicate for any child elements. For example, the following file-finding predicate looks for all *.hs files, but under any .git' directory looks only for a file named config: [if_ (name_ ".git" >> directory) (ignore >> recurse (name_ "config")) (glob "*.hs") NOTE: If this code had used recurse (glob "*.hs"))5 instead in the else case, it would have meant that .gitQ is only looked for at the top-level of the search (i.e., the top-most element).L)*+,-./01 23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW   C)*+,/.-01 23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWNoneHMA 9 is a tree of values, where the (possible) branches are Xs.Turn a generated list into a X.Descend one level into a A, yielding a list of values and their possible associated trees. %Perform a depth-first traversal of a  , yielding a X† of its contents. Note that breadth-first traversals cannot offer static memory guarantees, so they are not provided by this module.!Given a , produce another r which yields only those elements (and sub-trees) matching the given monadic conditional. This conditional (see â) can choose both elements and points of recursion, making it capable of expressing any tree traversal in the form of a predicate DSL. This differs from an expression-based traversal, like XPath or Lens, in that effects in m may be used to guide selection.DFor example, to print all Haskell files under the current directory: ™ let files = winnow (directoryFiles ".") $ do path <- query liftIO $ putStrLn $ "Considering " ++ path when (path `elem` ["./ .git", "./ dist", "./hresult"]) prune -- ignore these, and don't recurse into them guard_ (".hs"  `isInfixOf`) -- implicitly references path? runEffect $ for (enumerate (walk files)) $ liftIO . print  ! ! ! !Y      !"#$%&'()*(+,(-.()/(01(02 3456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdhierarchy-0.3.0 Control.Cond Pipes.Tree MonadQueryqueryqueriesupdateupdatesCondCondTrunCondTrunCond execCondT evalCondTtestguardMguard_guardM_applyconsideracceptignore norecurseprunematchesif_when_unless_or_and_not_recurseTreeT selectEachdescendwalkwinnow mtl-2.2.1Control.Monad.Reader.Class MonadReaderbase Control.Monadguard Data.MaybeJustControl.Applicativeemptywhen Data.Foldableasum sequence_getCondTCondRRecursorContinueRecurseStopaccept'recurse'$fMonadQueryrWriterT$fMonadQueryrWriterT0$fMonadQueryrStateT$fMonadQueryrStateT0$fMonadQueryrMaybeT$fMonadQueryrListT$fMonadQueryrIdentityT$fMonadQueryrExceptT$fMonadQueryrErrorT$fMonadQueryr'ContT$fMonadQueryrRWST$fMonadQueryrRWST0$fMonadQueryrReaderT$fMonadQueryaCondT$fMonadFixCondT$fMonadZipCondT$fMonadContCondT$fMFunctorCondT$fMonadBaseControlbCondT$fMonadTransCondT$fMonadIOCondT$fMonadBasebCondT$fMonadMaskCondT$fMonadCatchCondT$fMonadThrowCondT$fMonadErroreCondT$fMonadPlusCondT$fAlternativeCondT$fMonadStatesCondT$fMonadWriterwCondT$fMonadReaderrCondT $fMonadCondT$fApplicativeCondT $fMonoidCondT$fSemigroupCondT$fMFunctorRecursor$fMonoidRecursor$fSemigroupRecursor pipes-4.1.6PipesListT