Hoogle Search
Within LTS Haskell 24.28 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
mapBufferM :: (Unbox a, Unbox b) => (a -> IO b) -> Buffer a -> IO (Vector b)vector-buffer Data.Vector.Unboxed.Buffer monadic map over a buffer
mapBufferM_ :: Unbox a => (a -> IO b) -> Buffer a -> IO ()vector-buffer Data.Vector.Unboxed.Buffer monadic map over a buffer
mapAccumL :: Traversable t => (s -> a -> (s, b)) -> s -> t a -> (s, t b)verset Verset 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)verset Verset 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])verset Verset 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]verset Verset 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 -> averset Verset 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.
mapChildren :: String -> Element -> (Element -> Maybe a) -> Maybe [a]xml-helpers Text.XML.Light.Helpers Map the given function over the children of the given element with the given name.
mapChildrenWithAttName :: String -> Element -> (Element -> Maybe a) -> Maybe [a]xml-helpers Text.XML.Light.Helpers Map the given function over the children of the given element that have an attribute "name" matching the given string.
mapElements :: String -> Element -> (Element -> Maybe a) -> Maybe [a]xml-helpers Text.XML.Light.Helpers Map the given function over all subelements of the given element with the given name.