findM (Just . isUpper) "teST" == Just (Just 'S') findM (Just . isUpper) "test" == Just Nothing findM (Just . const True) ["x",undefined] == Just (Just "x")
findM = Stream.fold Fold.findM
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.
findMax (fromList [(5,"a"), (3,"b")]) == (5,"a") findMax empty Error: empty map has no maximal element
findMin (fromList [(5,"a"), (3,"b")]) == (3,"b") findMin empty Error: empty map has no minimal element