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.

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

    extra Control.Monad.Extra

    A version of mapMaybe that works with a monadic predicate.

  2. mapLeft :: (a -> c) -> Either a b -> Either c b

    extra Data.Either.Extra

    The mapLeft function takes a function and applies it to an Either value iff the value takes the form Left _.

    mapLeft show (Left 1) == Left "1"
    mapLeft show (Right True) == Right True
    

  3. mapRight :: (b -> c) -> Either a b -> Either a c

    extra Data.Either.Extra

    The mapRight function takes a function and applies it to an Either value iff the value takes the form Right _.

    mapRight show (Left 1) == Left 1
    mapRight show (Right True) == Right "True"
    

  4. mapLeft :: (a -> c) -> Either a b -> Either c b

    extra Extra

    The mapLeft function takes a function and applies it to an Either value iff the value takes the form Left _.

    mapLeft show (Left 1) == Left "1"
    mapLeft show (Right True) == Right True
    

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

    extra Extra

    A version of mapMaybe that works with a monadic predicate.

  6. mapRight :: (b -> c) -> Either a b -> Either a c

    extra Extra

    The mapRight function takes a function and applies it to an Either value iff the value takes the form Right _.

    mapRight show (Left 1) == Left 1
    mapRight show (Right True) == Right "True"
    

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

    validity Data.Validity

    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.

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

    base-compat Data.Monoid.Compat

    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.

  9. mapAccumM :: (Monad m, Traversable t) => (s -> a -> m (s, b)) -> s -> t a -> m (s, t b)

    base-compat Data.Traversable.Compat

    The mapAccumM function behaves like a combination of mapM and mapAccumL that traverses the structure while evaluating the actions and passing an accumulating parameter from left to right. It returns a final value of this accumulator together with the new structure. The accumulator is often used for caching the intermediate results of a computation.

    Examples

    Basic usage:
    >>> let expensiveDouble a = putStrLn ("Doubling " <> show a) >> pure (2 * a)
    
    >>> :{
    mapAccumM (\cache a -> case lookup a cache of
    Nothing -> expensiveDouble a >>= \double -> pure ((a, double):cache, double)
    Just double -> pure (cache, double)
    ) [] [1, 2, 3, 1, 2, 3]
    :}
    Doubling 1
    Doubling 2
    Doubling 3
    ([(3,6),(2,4),(1,2)],[2,4,6,2,4,6])
    

  10. mapPair :: Applicative f => (a -> f c, b -> f d) -> (a, b) -> f (c, d)

    utility-ht Control.Applicative.HT

    No documentation available.

Page 84 of many | Previous | Next