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.

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

    rio RIO.Prelude

    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_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()

    rio RIO.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.

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

    rio RIO.Prelude

    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]
    

  4. mapMaybeA :: Applicative f => (a -> f (Maybe b)) -> [a] -> f [b]

    rio RIO.Prelude

    Applicative mapMaybe.

  5. mapMaybeM :: Monad m => (a -> m (Maybe b)) -> [a] -> m [b]

    rio RIO.Prelude

    Monadic mapMaybe.

  6. mappend :: Monoid a => a -> a -> a

    rio RIO.Prelude

    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.

  7. mapWithIndex :: (Int -> a -> b) -> Seq a -> Seq b

    rio RIO.Seq

    A generalization of fmap, mapWithIndex takes a mapping function that also depends on the element's index, and applies it to every element in the sequence.

  8. mapMonotonic :: (a -> b) -> Set a -> Set b

    rio RIO.Set.Unchecked

    The mapMonotonic f s == map f s, but works only when f is strictly increasing. The precondition is not checked. Semi-formally, we have:

    and [x < y ==> f x < f y | x <- ls, y <- ls]
    ==> mapMonotonic f s == map f s
    where ls = toList s
    

  9. mapState :: ((a, s) -> (b, s)) -> State s a -> State s b

    rio RIO.State

    Map both the return value and final state of a computation using the given function.

  10. mapStateT :: (m (a, s) -> n (b, s)) -> StateT s m a -> StateT s n b

    rio RIO.State

    Map both the return value and final state of a computation using the given function.

Page 126 of many | Previous | Next