Hoogle Search
Within LTS Haskell 24.6 (ghc-9.10.2)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
mapMaybe :: Ord k => (a -> Maybe b) -> Map k a -> Map k bdhall Dhall.Map Transform all values in a Map using the supplied function, deleting the key if the function returns Nothing
>>> mapMaybe Data.Maybe.listToMaybe (fromList [("C",[1]),("B",[]),("A",[3])]) fromList [("C",1),("A",3)]
mapMOf :: LensLike (WrappedMonad m) s t a b -> (a -> m b) -> s -> m tdhall Dhall.Optics Identical to Control.Lens.mapMOf
mapMaybe :: (a -> Maybe b) -> [a] -> [b]foundation Foundation The mapMaybe function is a version of map which can throw out elements. In particular, the functional argument returns something of type Maybe b. If this is Nothing, no element is added on to the result list. If it is Just b, then b is included in the result list.
Examples
Using mapMaybe f x is a shortcut for catMaybes $ map f x in most cases:>>> import GHC.Internal.Text.Read ( readMaybe ) >>> let readMaybeInt = readMaybe :: String -> Maybe Int >>> mapMaybe readMaybeInt ["1", "Foo", "3"] [1,3] >>> catMaybes $ map readMaybeInt ["1", "Foo", "3"] [1,3]
If we map the Just constructor, the entire list should be returned:>>> mapMaybe Just [1,2,3] [1,2,3]
mapM_ :: (Mappable col, Applicative m, Monad m) => (a -> m b) -> col a -> m ()foundation Foundation.Collection Evaluate each action in the collection from left to right, and ignore the results. For a version that doesn't ignore the results see sequenceA. sequenceA_ :: (Mappable col, Applicative f) => col (f a) -> f () sequenceA_ col = sequenceA col *> pure () Map each element of a collection to a monadic action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see mapM.
mapM_ :: (Context a, Monad m) => (a -> m b) -> Matrix a -> m ()matrices Data.Matrix No documentation available.
-
matrices Data.Matrix.Generic No documentation available.
mapM_ :: (Context a, Monad m) => (a -> m b) -> Matrix a -> m ()matrices Data.Matrix.Storable No documentation available.
mapM_ :: (Context a, Monad m) => (a -> m b) -> Matrix a -> m ()matrices Data.Matrix.Unboxed No documentation available.
mapMaybe :: (a -> Maybe b) -> MonoidalIntMap a -> MonoidalIntMap bmonoidal-containers Data.IntMap.Monoidal No documentation available.
mapMaybeWithKey :: (Int -> a -> Maybe b) -> MonoidalIntMap a -> MonoidalIntMap bmonoidal-containers Data.IntMap.Monoidal No documentation available.