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.
mapM :: (Monad m, Storable a, Storable b) => (a -> m b) -> Vector a -> m (Vector b)rio RIO.Vector.Storable No documentation available.
mapM_ :: (Monad m, Storable a) => (a -> m b) -> Vector a -> m ()rio RIO.Vector.Storable No documentation available.
mapMaybe :: (Storable a, Storable b) => (a -> Maybe b) -> Vector a -> Vector brio RIO.Vector.Storable No documentation available.
mapM :: (Monad m, Unbox a, Unbox b) => (a -> m b) -> Vector a -> m (Vector b)rio RIO.Vector.Unboxed No documentation available.
mapM_ :: (Monad m, Unbox a) => (a -> m b) -> Vector a -> m ()rio RIO.Vector.Unboxed No documentation available.
mapMaybe :: (Unbox a, Unbox b) => (a -> Maybe b) -> Vector a -> Vector brio RIO.Vector.Unboxed No documentation available.
mapWriter :: ((a, w) -> (b, w')) -> Writer w a -> Writer w' brio RIO.Writer Map both the return value and output of a computation using the given function.
mapWriterT :: (m (a, w) -> n (b, w')) -> WriterT w m a -> WriterT w' n brio RIO.Writer Map both the return value and output of a computation using the given function.
runWriterT (mapWriterT f m) = f (runWriterT m)
mapExceptT :: (m (Either e a) -> n (Either e' b)) -> ExceptT e m a -> ExceptT e' n berrors Control.Error Map the unwrapped computation using the given function.
runExceptT (mapExceptT f m) = f (runExceptT m)
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]