Hoogle Search
Within LTS Haskell 24.20 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
firstJustM :: Monad m => (a -> m (Maybe b)) -> [a] -> m (Maybe b)extra Control.Monad.Extra Like findM, but also allows you to compute some additional information in the predicate.
untilJustM :: Monad m => m (Maybe a) -> m aextra Control.Monad.Extra Keep running an operation until it becomes a Just, then return the value inside the Just as the result of the overall loop.
whenJust :: Applicative m => Maybe a -> (a -> m ()) -> m ()extra Control.Monad.Extra Perform some operation on Just, given the field inside the Just. This is a specialized for_.
whenJust Nothing print == pure () whenJust (Just 1) print == print 1
whenJustM :: Monad m => m (Maybe a) -> (a -> m ()) -> m ()extra Control.Monad.Extra Like whenJust, but where the test can be monadic.
whileJustM :: (Monad m, Monoid a) => m (Maybe a) -> m aextra Control.Monad.Extra Keep running an operation until it becomes a Nothing, accumulating the monoid results inside the Justs as the result of the overall loop.
firstJustM :: (Foldable f, Monad m) => (a -> m (Maybe b)) -> f a -> m (Maybe b)extra Data.Foldable.Extra A generalization of firstJustM to Foldable instances.
firstJust :: (a -> Maybe b) -> [a] -> Maybe bextra Data.List.Extra Find the first element of a list for which the operation returns Just, along with the result of the operation. Like find but useful where the function also computes some expensive information that can be reused. Particular useful when the function is monadic, see firstJustM.
firstJust id [Nothing,Just 3] == Just 3 firstJust id [Nothing,Nothing] == Nothing
catchJust_ :: (SomeException -> Maybe b) -> IO a -> (b -> IO a) -> IO aextra Extra firstJust :: (a -> Maybe b) -> [a] -> Maybe bextra Extra Find the first element of a list for which the operation returns Just, along with the result of the operation. Like find but useful where the function also computes some expensive information that can be reused. Particular useful when the function is monadic, see firstJustM.
firstJust id [Nothing,Just 3] == Just 3 firstJust id [Nothing,Nothing] == Nothing
firstJustM :: Monad m => (a -> m (Maybe b)) -> [a] -> m (Maybe b)extra Extra Like findM, but also allows you to compute some additional information in the predicate.