Hoogle Search
Within LTS Haskell 24.33 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
mapMaybeM :: Monad m => (a -> m (Maybe b)) -> [a] -> m [b]relude Relude.Monad.Maybe The monadic version of the mapMaybe function.
>>> :{ evenInHalf :: Int -> IO (Maybe Int) evenInHalf n | even n = pure $ Just $ n `div` 2 | otherwise = pure Nothing :}>>> mapMaybeM evenInHalf [1..10] [1,2,3,4,5]
mapAndUnzipM :: Applicative m => (a -> m (b, c)) -> [a] -> m ([b], [c])relude Relude.Monad.Reexport The mapAndUnzipM function maps its first argument over a list, returning the result as a pair of lists. This function is mainly used with complicated data structures or a state monad.
mapMaybe :: (a -> Maybe b) -> [a] -> [b]relude Relude.Monad.Reexport 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]
mappend :: Monoid a => a -> a -> arelude Relude.Monoid An associative operation NOTE: This method is redundant and has the default implementation mappend = (<>) since base-4.11.0.0. Should it be implemented manually, since mappend is a synonym for (<>), it is expected that the two functions are defined the same way. In a future GHC release mappend will be removed from Monoid.
mapExcept :: (Either e a -> Either e' b) -> Except e a -> Except e' bselective Control.Selective.Trans.Except No documentation available.
mapExceptT :: (m (Either e a) -> n (Either e' b)) -> ExceptT e m a -> ExceptT e' n bselective Control.Selective.Trans.Except No documentation available.
-
vinyl Data.Vinyl Apply a typeclass method to each field of a FieldRec. This is a specialization of rmapMethod.
-
vinyl Data.Vinyl.Class.Method Apply a typeclass method to each field of a FieldRec. This is a specialization of rmapMethod.
mapDefault :: Ord key => elem -> key -> Accessor (Map key elem) elemdistributed-process Control.Distributed.Process.Internal.StrictContainerAccessors No documentation available.
mapMaybe :: Ord key => key -> Accessor (Map key elem) (Maybe elem)distributed-process Control.Distributed.Process.Internal.StrictContainerAccessors No documentation available.