Hoogle Search

Within LTS Haskell 24.7 (ghc-9.10.2)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)

    ghc-lib GHC.HsToCore.Monad

    Map each element of a structure to a monadic action, evaluate these actions from left to right, and collect the results. For a version that ignores the results see mapM_.

    Examples

    mapM is literally a traverse with a type signature restricted to Monad. Its implementation may be more efficient due to additional power of Monad.

  2. mapM :: forall m (u :: Type -> Type) a (v :: Type -> Type) b c d . (Monad m, Vector u a, Vector v b, Vector u c, Vector v d) => ((a, b) -> m (c, d)) -> Vector u v (a, b) -> m (Vector u v (c, d))

    hybrid-vectors Data.Vector.Hybrid

    O(n) Apply the monadic action to all elements of the vector, yielding a vector of results

  3. mapM :: MonadUnliftIO m => (a -> m b) -> InputStream a -> m (InputStream b)

    unliftio-streams UnliftIO.Streams.Combinators

    No documentation available.

  4. mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)

    xmonad-contrib XMonad.Config.Prime

    Map each element of a structure to a monadic action, evaluate these actions from left to right, and collect the results. For a version that ignores the results see mapM_.

    Examples

    mapM is literally a traverse with a type signature restricted to Monad. Its implementation may be more efficient due to additional power of Monad.

  5. type family MapM (arg :: a ~> m b) (arg1 :: t a) :: m t b

    singletons-base Control.Monad.Singletons

    No documentation available.

  6. mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()

    base Prelude

    Map each element of a structure 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_ is just like traverse_, but specialised to monadic actions.

  7. mapMaybe :: (a -> Maybe b) -> [a] -> [b]

    base Data.Maybe

    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]
    

  8. mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()

    base Control.Monad

    Map each element of a structure 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_ is just like traverse_, but specialised to monadic actions.

  9. mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()

    base Data.Foldable

    Map each element of a structure 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_ is just like traverse_, but specialised to monadic actions.

  10. mapMaybe :: (a -> Maybe b) -> IntMap a -> IntMap b

    containers Data.IntMap.Internal

    Map values and collect the Just results.

    let f x = if x == "a" then Just "new a" else Nothing
    mapMaybe f (fromList [(5,"a"), (3,"b")]) == singleton 5 "new a"
    

Page 11 of many | Previous | Next