Hoogle Search
Within LTS Haskell 24.4 (ghc-9.10.2)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
mapStateT :: (m (a, s) -> n (b, s)) -> StateT s m a -> StateT s n brebase Rebase.Prelude Map both the return value and final state of a computation using the given function.
mapWriter :: ((a, w) -> (b, w')) -> Writer w a -> Writer w' brebase Rebase.Prelude 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 brebase Rebase.Prelude Map both the return value and output of a computation using the given function.
runWriterT (mapWriterT f m) = f (runWriterT m)
mappend :: Monoid a => a -> a -> arebase Rebase.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.
mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)mixed-types-num Numeric.MixedTypes.PreludeHiding 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.mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()mixed-types-num Numeric.MixedTypes.PreludeHiding 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.
mappend :: Monoid a => a -> a -> amixed-types-num Numeric.MixedTypes.PreludeHiding 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.
mapAccumL :: Traversable t => (s -> a -> (s, b)) -> s -> t a -> (s, t b)LambdaHack Game.LambdaHack.Core.Prelude The mapAccumL function behaves like a combination of fmap and foldl; it applies a function to each element of a structure, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new structure.
Examples
Basic usage:>>> mapAccumL (\a b -> (a + b, a)) 0 [1..10] (55,[0,1,3,6,10,15,21,28,36,45])
>>> mapAccumL (\a b -> (a <> show b, a)) "0" [1..5] ("012345",["0","01","012","0123","01234"])
mapAccumR :: Traversable t => (s -> a -> (s, b)) -> s -> t a -> (s, t b)LambdaHack Game.LambdaHack.Core.Prelude The mapAccumR function behaves like a combination of fmap and foldr; it applies a function to each element of a structure, passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new structure.
Examples
Basic usage:>>> mapAccumR (\a b -> (a + b, a)) 0 [1..10] (55,[54,52,49,45,40,34,27,19,10,0])
>>> mapAccumR (\a b -> (a <> show b, a)) "0" [1..5] ("054321",["05432","0543","054","05","0"])
mapAndUnzipM :: Applicative m => (a -> m (b, c)) -> [a] -> m ([b], [c])LambdaHack Game.LambdaHack.Core.Prelude 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.