findM

Like find, but where the test can be monadic.
findM (Just . isUpper) "teST"             == Just (Just 'S')
findM (Just . isUpper) "test"             == Just Nothing
findM (Just . const True) ["x",undefined] == Just (Just "x")
A generalization of findM to Foldable instances.
Returns the first element that satisfies the given predicate.
findM = Stream.fold Fold.findM
Returns the first element that satisfies the given predicate. Pre-release
Like find, but takes a monadic function instead; retains the short-circuiting behaviour of the non-monadic version. For example,
findM (\a -> putStr (show a <> " ") >> pure False) [1..10]
would print "1 2 3 4 5 6 7 8 9 10" and return Nothing, while
findM (\a -> putStr (show a <> " ") >> pure True) [1..10]
would print "1" and return Just 1.
Yield Just the first element that satisfies the monadic predicate or Nothing if no such element exists.
The maximal key of the map. Calls error if the map is empty.
The minimal key of the map. Calls error if the map is empty.
The maximal element of the set. Calls error if the set is empty.
The minimal element of the set. Calls error if the set is empty.
The maximal key of the map. Calls error if the map is empty.
findMax (fromList [(5,"a"), (3,"b")]) == (5,"a")
findMax empty                            Error: empty map has no maximal element
The minimal key of the map. Calls error if the map is empty.
findMin (fromList [(5,"a"), (3,"b")]) == (3,"b")
findMin empty                            Error: empty map has no minimal element
The maximal element of the set. Calls error if the set is empty.
The minimal element of the set. Calls error if the set is empty.
The findMOf function takes a Lens (or Getter, Iso, Fold, or Traversal), a monadic predicate and a structure and returns in the monad the leftmost element of the structure matching the predicate, or Nothing if there is no such element.
>>> findMOf each ( \x -> print ("Checking " ++ show x) >> return (even x)) (1,3,4,6)
"Checking 1"
"Checking 3"
"Checking 4"
Just 4
>>> findMOf each ( \x -> print ("Checking " ++ show x) >> return (even x)) (1,3,5,7)
"Checking 1"
"Checking 3"
"Checking 5"
"Checking 7"
Nothing
findMOf :: (Monad m, Getter s a)     -> (a -> m Bool) -> s -> m (Maybe a)
findMOf :: (Monad m, Fold s a)       -> (a -> m Bool) -> s -> m (Maybe a)
findMOf :: (Monad m, Iso' s a)       -> (a -> m Bool) -> s -> m (Maybe a)
findMOf :: (Monad m, Lens' s a)      -> (a -> m Bool) -> s -> m (Maybe a)
findMOf :: (Monad m, Traversal' s a) -> (a -> m Bool) -> s -> m (Maybe a)
findMOf folded :: (Monad m, Foldable f) => (a -> m Bool) -> f a -> m (Maybe a)
ifindMOf l ≡ findMOf l . Indexed
A simpler version that didn't permit indexing, would be:
findMOf :: Monad m => Getting (Endo (m (Maybe a))) s a -> (a -> m Bool) -> s -> m (Maybe a)
findMOf l p = foldrOf l (a y -> p a >>= x -> if x then return (Just a) else y) $ return Nothing
Find the file corresponding to a Haskell module name. This is similar to findFileCwdWithExtension' but specialised to a module name. The function fails if the file corresponding to the module is missing.
Find the file corresponding to a Haskell module name. This is similar to findFileWithExtension' but specialised to a module name. The function fails if the file corresponding to the module is missing.
Finds the files corresponding to a list of Haskell module names. As findModuleFileCwd but for a list of module names.
Finds the files corresponding to a list of Haskell module names. As findModuleFile but for a list of module names.
Takes a ModuleName and possibly a UnitId, and consults the filesystem and package database to find the corresponding Module, using the algorithm that is used for an import declaration.
The maximal key of the map. Calls error if the map is empty. Use maxViewWithKey if the map may be empty.