pkM      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLNone3;=>?AFKLNQTV]Uu is a custom version of M4, created so that users could still have their own M 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 Nm 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 OH 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 P.b prevents recursion into the current entry's descendents, but does not ignore the entry itself.= is a synonym for both ignoring an entry and its descendents.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 Qa, 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 Q`, 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 R.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 S.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).     TUVWXYNoneQVjHA HY is a tree of values, where the (possible) branches are represented by some MonadPlus m.I+Turn a list into a series of possibilities:JDescend one level into a HC, yielding a list of values and their possible associated trees.K%Perform a depth-first traversal of a H, yielding each of its contents. Note that breadth-first traversals cannot offer static memory guarantees, so they are not provided by this module.LGiven a H, produce another Hv 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", "./`result"]) prune -- ignore these, and don't recurse into them guard_ (".hs"  `isInfixOf`) -- implicitly references path% forM_ (walk files) $ liftIO . print HIJKLHIJKLSafekZZ[\]^_`ab      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVTWXTWYTWZT[\T[] ^_`abcdefghijk&hierarchy-1.0.2-3u566hEtxMb1rjGEy3T3jQ Control.Cond HierarchyPaths_hierarchy MonadQueryqueryqueriesupdateupdatesCondCondTrunCondTrunCond execCondT evalCondTtestguardMguard_guardM_applyconsideracceptignore norecurseprunematchesifMif_whenMwhen_unlessMunless_or_and_not_recurse$fMonadFixCondT$fMonadZipCondT$fMonadContCondT$fMFunctorTYPECondT$fMonadBaseControlbCondT$fMonadTransCondT$fMonadIOCondT$fMonadBasebCondT$fMonadMaskCondT$fMonadCatchCondT$fMonadThrowCondT$fMonadErroreCondT$fMonadPlusCondT$fAlternativeCondT$fMonadStatesCondT$fMonadWriterwCondT$fMonadReaderrCondT $fMonadCondT$fApplicativeCondT $fMonoidCondT$fSemigroupCondT$fMFunctorTYPERecursor$fMonoidRecursor$fSemigroupRecursor$fMonadQueryrWriterT$fMonadQueryrWriterT0$fMonadQueryrStateT$fMonadQueryrStateT0$fMonadQueryrMaybeT$fMonadQueryrListT$fMonadQueryrIdentityT$fMonadQueryrExceptT$fMonadQueryrErrorT$fMonadQueryr'ContT$fMonadQueryrRWST$fMonadQueryrRWST0$fMonadQueryrReaderT$fMonadQueryaCondT$fFunctorCondT$fFunctorRecursorTreeTselectdescendwalkwinnow mtl-2.2.2-IqWgmFcHnX2E7PrBkSGNvnControl.Monad.Reader.Class MonadReaderbase Control.MonadguardGHC.BaseJustemptywhen Data.Foldableasum sequence_getCondTRecursorStopRecurseContinueversion getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileName