Hoogle Search
Within LTS Haskell 24.4 (ghc-9.10.2)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
mapMaybe :: Ord b => (a -> Maybe b) -> MaxQueue a -> MaxQueue bpqueue Data.PQueue.Max Maps a function over the elements of the queue, and collects the Just values.
mapMaybe :: Ord b => (a -> Maybe b) -> MinQueue a -> MinQueue bpqueue Data.PQueue.Min Map elements and collect the Just results.
mapMaybe :: Ord k => (a -> Maybe b) -> MaxPQueue k a -> MaxPQueue k bpqueue Data.PQueue.Prio.Max Map values and collect the Just results.
mapMaybe :: Ord k => (a -> Maybe b) -> MinPQueue k a -> MinPQueue k bpqueue Data.PQueue.Prio.Min Map values and collect the Just results.
-
contiguous Data.Primitive.Contiguous The mapMaybe function is a version of map which can throw out elements. In particular, the functional arguments returns something of type Maybe b. If this is Nothing, no element is added on to the result array. If it is Just b, then b is included in the result array.
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)]
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]
mapMaybe :: (a -> Maybe b) -> MonoidalIntMap a -> MonoidalIntMap bmonoidal-containers Data.IntMap.Monoidal No documentation available.
mapMaybe :: (a -> Maybe b) -> MonoidalIntMap a -> MonoidalIntMap bmonoidal-containers Data.IntMap.Monoidal.Strict No documentation available.
mapMaybe :: forall k a b . (a -> Maybe b) -> MonoidalMap k a -> MonoidalMap k bmonoidal-containers Data.Map.Monoidal No documentation available.