Hoogle Search
Within LTS Haskell 24.26 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
mapMaybe :: (a -> Maybe b) -> [a] -> [b]errors Control.Error 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]
mapMaybeT :: (m (Maybe a) -> n (Maybe b)) -> MaybeT m a -> MaybeT n berrors Control.Error Transform the computation inside a MaybeT.
mapM_ :: HashTable h => ((k, v) -> ST s b) -> h s k v -> ST s ()hashtables Data.HashTable.Class A side-effecting map over the key-value records of a hash table. O(n).
mapM_ :: HashTable h => ((k, v) -> IO a) -> IOHashTable h k v -> IO ()hashtables Data.HashTable.IO See the documentation for this function in mapM_.
mapM_ :: ((k, v) -> ST s b) -> HashTable s k v -> ST s ()hashtables Data.HashTable.ST.Basic See the documentation for this function in mapM_.
mapM_ :: ((k, v) -> ST s a) -> HashTable s k v -> ST s ()hashtables Data.HashTable.ST.Cuckoo See the documentation for this function in mapM_.
mapM_ :: ((k, v) -> ST s b) -> HashTable s k v -> ST s ()hashtables Data.HashTable.ST.Linear See the documentation for this function in Data.HashTable.Class#v:mapM_.
mapInputT :: (forall b . () => m b -> m b) -> InputT m a -> InputT m ahaskeline System.Console.Haskeline Map a user interaction by modifying the base monad computation.
map_ :: Term arg result => arg -> resultlucid Lucid.Html5 map element
-
storablevector Data.StorableVector The mapAccumL function behaves like a combination of map and foldl; it applies a function to each element of a Vector, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new list.