map -base

map :: (Char -> Char) -> ByteString -> ByteString
bytestring Data.ByteString.Char8, bytestring Data.ByteString.Lazy.Char8
O(n) map f xs is the ByteString obtained by applying f to each element of xs
map :: (Char -> Char) -> Text -> Text
text Data.Text, text Data.Text.Lazy
O(n) map f t is the Text obtained by applying f to each element of t. Subject to fusion. Performs replacement on invalid scalar values.
map :: (Key -> Key) -> IntSet -> IntSet
containers Data.IntSet
O(n*min(n,W)). map f s is the set obtained by applying f to each element of s. It's worth noting that the size of the result may be smaller if, for some (x,y), x /= y && f x == f y
map :: (Word8 -> Word8) -> ByteString -> ByteString
bytestring Data.ByteString.Lazy
O(n) map f xs is the ByteString obtained by applying f to each element of xs.
map :: (Word8 -> Word8) -> ByteString -> ByteString
bytestring Data.ByteString
O(n) map f xs is the ByteString obtained by applying f to each element of xs. This function is subject to array fusion.
map :: (a -> b) -> IntMap a -> IntMap b
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n). Map a function over all values in the map. > map (++ "x") (fromList [(5,"a"), (3,"b")]) == fromList [(3, "bx"), (5, "ax")]
map :: (a -> b) -> Map k a -> Map k b
containers Data.Map.Lazy, containers Data.Map.Strict
O(n). Map a function over all values in the map. > map (++ "x") (fromList [(5,"a"), (3,"b")]) == fromList [(3, "bx"), (5, "ax")]
map :: Ord b => (a -> b) -> Set a -> Set b
containers Data.Set
O(n*log n). map f s is the set obtained by applying f to each element of s. It's worth noting that the size of the result may be smaller if, for some (x,y), x /= y && f x == f y
map1 :: (Map1 m, ControlPoint c, Domain d) => StateVar (Maybe (m c d))
OpenGL Graphics.Rendering.OpenGL.GL.Evaluators
map2 :: (Map2 m, ControlPoint c, Domain d) => StateVar (Maybe (m c d))
OpenGL Graphics.Rendering.OpenGL.GL.Evaluators
mapAccum :: (a -> b -> (a, c)) -> a -> IntMap b -> (a, IntMap c)
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n). The function mapAccum threads an accumulating argument through the map in ascending order of keys. > let f a b = (a ++ b, b ++ "X") > mapAccum f "Everything: " (fromList [(5,"a"), (3,"b")]) == ("Everything: ba", fromList [(3, "bX"), (5, "aX")])
mapAccum :: (a -> b -> (a, c)) -> a -> Map k b -> (a, Map k c)
containers Data.Map.Lazy, containers Data.Map.Strict
O(n). The function mapAccum threads an accumulating argument through the map in ascending order of keys. > let f a b = (a ++ b, b ++ "X") > mapAccum f "Everything: " (fromList [(5,"a"), (3,"b")]) == ("Everything: ba", fromList [(3, "bX"), (5, "aX")])
mapAccumL :: (a -> Char -> (a, Char)) -> a -> Text -> (a, Text)
text Data.Text, text Data.Text.Lazy
O(n) Like a combination of map and foldl'. Applies a function to each element of a Text, passing an accumulating parameter from left to right, and returns a final Text. Performs replacement on invalid scalar values.
mapAccumL :: (acc -> Char -> (acc, Char)) -> acc -> ByteString -> (acc, ByteString)
bytestring Data.ByteString.Lazy.Char8
The mapAccumL function behaves like a combination of map and foldl; it applies a function to each element of a ByteString, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new ByteString.
mapAccumL :: (acc -> Char -> (acc, Char)) -> acc -> ByteString -> (acc, ByteString)
bytestring Data.ByteString.Char8
The mapAccumL function behaves like a combination of map and foldl; it applies a function to each element of a ByteString, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new list.
mapAccumL :: (acc -> Word8 -> (acc, Word8)) -> acc -> ByteString -> (acc, ByteString)
bytestring Data.ByteString.Lazy
The mapAccumL function behaves like a combination of map and foldl; it applies a function to each element of a ByteString, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new ByteString.
mapAccumL :: (acc -> Word8 -> (acc, Word8)) -> acc -> ByteString -> (acc, ByteString)
bytestring Data.ByteString
The mapAccumL function behaves like a combination of map and foldl; it applies a function to each element of a ByteString, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new list.
mapAccumR :: (a -> Char -> (a, Char)) -> a -> Text -> (a, Text)
text Data.Text, text Data.Text.Lazy
The mapAccumR function behaves like a combination of map and a strict foldr; it applies a function to each element of a Text, passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new Text. Performs replacement on invalid scalar values.
mapAccumR :: (acc -> Char -> (acc, Char)) -> acc -> ByteString -> (acc, ByteString)
bytestring Data.ByteString.Char8, bytestring Data.ByteString.Lazy.Char8
The mapAccumR function behaves like a combination of map and foldr; it applies a function to each element of a ByteString, passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new ByteString.
mapAccumR :: (acc -> Word8 -> (acc, Word8)) -> acc -> ByteString -> (acc, ByteString)
bytestring Data.ByteString, bytestring Data.ByteString.Lazy
The mapAccumR function behaves like a combination of map and foldr; it applies a function to each element of a ByteString, passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new ByteString.
mapAccumRWithKey :: (a -> Key -> b -> (a, c)) -> a -> IntMap b -> (a, IntMap c)
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n). The function mapAccumR threads an accumulating argument through the map in descending order of keys.
mapAccumRWithKey :: (a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c)
containers Data.Map.Lazy, containers Data.Map.Strict
O(n). The function mapAccumR threads an accumulating argument through the map in descending order of keys.
mapAccumWithKey :: (a -> Key -> b -> (a, c)) -> a -> IntMap b -> (a, IntMap c)
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n). The function mapAccumWithKey threads an accumulating argument through the map in ascending order of keys. > let f a k b = (a ++ " " ++ (show k) ++ "-" ++ b, b ++ "X") > mapAccumWithKey f "Everything:" (fromList [(5,"a"), (3,"b")]) == ("Everything: 3-b 5-a", fromList [(3, "bX"), (5, "aX")])
mapAccumWithKey :: (a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c)
containers Data.Map.Lazy, containers Data.Map.Strict
O(n). The function mapAccumWithKey threads an accumulating argument through the map in ascending order of keys. > let f a k b = (a ++ " " ++ (show k) ++ "-" ++ b, b ++ "X") > mapAccumWithKey f "Everything:" (fromList [(5,"a"), (3,"b")]) == ("Everything: 3-b 5-a", fromList [(3, "bX"), (5, "aX")])
mapArray :: (MArray a e' m, MArray a e m, Ix i) => (e' -> e) -> a i e' -> m (a i e)
array Data.Array.MArray, array Data.Array.MArray.Safe
Constructs a new array derived from the original array by applying a function to each of the elements.
mapBuffer :: BufferTarget -> BufferAccess -> IO (Maybe (Ptr a))
OpenGL Graphics.Rendering.OpenGL.GL.BufferObjects
mapBufferRange :: BufferTarget -> Offset -> Length -> [MapBufferUsage] -> IO (Maybe (Ptr a))
OpenGL Graphics.Rendering.OpenGL.GL.BufferObjects
mapColor :: StateVar Capability
OpenGL Graphics.Rendering.OpenGL.GL.PixelRectangles.PixelTransfer
mapCont :: (r -> r) -> Cont r a -> Cont r a
transformers Control.Monad.Trans.Cont, mtl Control.Monad.Cont
Apply a function to transform the result of a continuation-passing computation. *  (mapCont f m) = f . runCont
mapContT :: (m r -> m r) -> ContT r m a -> ContT r m a
transformers Control.Monad.Trans.Cont, mtl Control.Monad.Cont
Apply a function to transform the result of a continuation-passing computation. *  (mapContT f m) = f . runContT
mapEither :: (a -> Either b c) -> IntMap a -> (IntMap b, IntMap c)
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n). Map values and separate the Left and Right results. > let f a = if a < "c" then Left a else Right a > mapEither f (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")]) > == (fromList [(3,"b"), (5,"a")], fromList [(1,"x"), (7,"z")]) > > mapEither (\ a -> Right a) (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")]) > == (empty, fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")])
mapEither :: (a -> Either b c) -> Map k a -> (Map k b, Map k c)
containers Data.Map.Lazy, containers Data.Map.Strict
O(n). Map values and separate the Left and Right results. > let f a = if a < "c" then Left a else Right a > mapEither f (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")]) > == (fromList [(3,"b"), (5,"a")], fromList [(1,"x"), (7,"z")]) > > mapEither (\ a -> Right a) (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")]) > == (empty, fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")])
mapEitherWithKey :: (Key -> a -> Either b c) -> IntMap a -> (IntMap b, IntMap c)
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n). Map keys/values and separate the Left and Right results. > let f k a = if k < 5 then Left (k * 2) else Right (a ++ a) > mapEitherWithKey f (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")]) > == (fromList [(1,2), (3,6)], fromList [(5,"aa"), (7,"zz")]) > > mapEitherWithKey (\_ a -> Right a) (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")]) > == (empty, fromList [(1,"x"), (3,"b"), (5,"a"), (7,"z")])
mapEitherWithKey :: (k -> a -> Either b c) -> Map k a -> (Map k b, Map k c)
containers Data.Map.Lazy, containers Data.Map.Strict
O(n). Map keys/values and separate the Left and Right results. > let f k a = if k < 5 then Left (k * 2) else Right (a ++ a) > mapEitherWithKey f (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")]) > == (fromList [(1,2), (3,6)], fromList [(5,"aa"), (7,"zz")]) > > mapEitherWithKey (\_ a -> Right a) (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")]) > == (empty, fromList [(1,"x"), (3,"b"), (5,"a"), (7,"z")])
mapErrorT :: (m (Either e a) -> n (Either e' b)) -> ErrorT e m a -> ErrorT e' n b
transformers Control.Monad.Trans.Error, mtl Control.Monad.Error
Map the unwrapped computation using the given function. *  (mapErrorT f m) = f (runErrorT >  
mapFst :: (a -> b) -> (a, c) -> (b, c)
fgl Data.Graph.Inductive.Query.Monad
mapGrid1 :: Domain d => StateVar (GLint, (d, d))
OpenGL Graphics.Rendering.OpenGL.GL.Evaluators
mapGrid2 :: Domain d => StateVar ((GLint, (d, d)), (GLint, (d, d)))
OpenGL Graphics.Rendering.OpenGL.GL.Evaluators
mapIdentityT :: (m a -> n b) -> IdentityT m a -> IdentityT n b
transformers Control.Monad.Trans.Identity
Lift a unary operation to the new monad.
mapIndices :: (MArray a e m, Ix i, Ix j) => (i, i) -> (i -> j) -> a j e -> m (a i e)
array Data.Array.MArray, array Data.Array.MArray.Safe
Constructs a new array derived from the original array by applying a function to each of the indices.
mapKeys :: (Key -> Key) -> IntMap a -> IntMap a
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n*min(n,W)). mapKeys f s is the map obtained by applying f to each key of s. The size of the result may be smaller if f maps two or more distinct keys to the same new key. In this case the value at the greatest of the original keys is retained. > mapKeys (+ 1) (fromList [(5,"a"), (3,"b")]) == fromList [(4, "b"), (6, "a")] > mapKeys (\ _ -> 1) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]) == singleton 1 "c" > mapKeys (\ _ -> 3) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]) == singleton 3 "c"
mapKeys :: Ord k2 => (k1 -> k2) -> Map k1 a -> Map k2 a
containers Data.Map.Lazy, containers Data.Map.Strict
O(n*log n). mapKeys f s is the map obtained by applying f to each key of s. The size of the result may be smaller if f maps two or more distinct keys to the same new key. In this case the value at the greatest of the original keys is retained. > mapKeys (+ 1) (fromList [(5,"a"), (3,"b")]) == fromList [(4, "b"), (6, "a")] > mapKeys (\ _ -> 1) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]) == singleton 1 "c" > mapKeys (\ _ -> 3) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]) == singleton 3 "c"
mapKeysMonotonic :: (Key -> Key) -> IntMap a -> IntMap a
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n*min(n,W)). mapKeysMonotonic f s == mapKeys f s, but works only when f is strictly monotonic. That is, for any values x and y, if x < y then f x < f y. The precondition is not checked. Semi-formally, we have: > and [x < y ==> f x < f y | x <- ls, y <- ls] > ==> mapKeysMonotonic f s == mapKeys f s > This means that f maps distinct original keys to distinct resulting keys. This function has slightly better performance than mapKeys. > mapKeysMonotonic (\ k -> k * 2) (fromList [(5,"a"), (3,"b")]) == fromList [(6, "b"), (10, "a")]
mapKeysMonotonic :: (k1 -> k2) -> Map k1 a -> Map k2 a
containers Data.Map.Lazy, containers Data.Map.Strict
O(n). mapKeysMonotonic f s == mapKeys f s, but works only when f is strictly monotonic. That is, for any values x and y, if x < y then f x < f y. The precondition is not checked. Semi-formally, we have: > and [x < y ==> f x < f y | x <- ls, y <- ls] > ==> mapKeysMonotonic f s == mapKeys f s > This means that f maps distinct original keys to distinct resulting keys. This function has better performance than mapKeys. > mapKeysMonotonic (\ k -> k * 2) (fromList [(5,"a"), (3,"b")]) == fromList [(6, "b"), (10, "a")] > valid (mapKeysMonotonic (\ k -> k * 2) (fromList [(5,"a"), (3,"b")])) == True > valid (mapKeysMonotonic (\ _ -> 1) (fromList [(5,"a"), (3,"b")])) == False
mapKeysWith :: (a -> a -> a) -> (Key -> Key) -> IntMap a -> IntMap a
containers Data.IntMap.Strict
O(n*log n). mapKeysWith c f s is the map obtained by applying f to each key of s. The size of the result may be smaller if f maps two or more distinct keys to the same new key. In this case the associated values will be combined using c. > mapKeysWith (++) (\ _ -> 1) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]) == singleton 1 "cdab" > mapKeysWith (++) (\ _ -> 3) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]) == singleton 3 "cdab"
mapKeysWith :: (a -> a -> a) -> (Key -> Key) -> IntMap a -> IntMap a
containers Data.IntMap.Lazy
O(n*min(n,W)). mapKeysWith c f s is the map obtained by applying f to each key of s. The size of the result may be smaller if f maps two or more distinct keys to the same new key. In this case the associated values will be combined using c. > mapKeysWith (++) (\ _ -> 1) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]) == singleton 1 "cdab" > mapKeysWith (++) (\ _ -> 3) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]) == singleton 3 "cdab"
mapKeysWith :: Ord k2 => (a -> a -> a) -> (k1 -> k2) -> Map k1 a -> Map k2 a
containers Data.Map.Lazy, containers Data.Map.Strict
O(n*log n). mapKeysWith c f s is the map obtained by applying f to each key of s. The size of the result may be smaller if f maps two or more distinct keys to the same new key. In this case the associated values will be combined using c. > mapKeysWith (++) (\ _ -> 1) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]) == singleton 1 "cdab" > mapKeysWith (++) (\ _ -> 3) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]) == singleton 3 "cdab"
mapListT :: (m [a] -> n [b]) -> ListT m a -> ListT n b
transformers Control.Monad.Trans.List, mtl Control.Monad.List
Map between ListT computations. *  (mapListT f m) = f (runListT >  
mapMaybe :: (a -> Maybe b) -> IntMap a -> IntMap b
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n). 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"
mapMaybe :: (a -> Maybe b) -> Map k a -> Map k b
containers Data.Map.Lazy, containers Data.Map.Strict
O(n). 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"
mapMaybeT :: (m (Maybe a) -> n (Maybe b)) -> MaybeT m a -> MaybeT n b
transformers Control.Monad.Trans.Maybe
Transform the computation inside a MaybeT. *  (mapMaybeT f m) = f (runMaybeT >  
mapMaybeWithKey :: (Key -> a -> Maybe b) -> IntMap a -> IntMap b
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n). Map keys/values and collect the Just results. > let f k _ = if k < 5 then Just ("key (:) " ++ (show k)) else Nothing > mapMaybeWithKey f (fromList [(5,"a"), (3,"b")]) == singleton 3 "key (:) 3"
mapMaybeWithKey :: (k -> a -> Maybe b) -> Map k a -> Map k b
containers Data.Map.Lazy, containers Data.Map.Strict
O(n). Map keys/values and collect the Just results. > let f k _ = if k < 5 then Just ("key (:) " ++ (show k)) else Nothing > mapMaybeWithKey f (fromList [(5,"a"), (3,"b")]) == singleton 3 "key (:) 3"
mapMonotonic :: (a -> b) -> Set a -> Set b
containers Data.Set
O(n). The mapMonotonic f s == map f s, but works only when f is monotonic. 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 >  
mapProp :: Testable prop => (Prop -> Prop) -> prop -> Property
QuickCheck Test.QuickCheck.Property
mapReader :: (a -> b) -> Reader r a -> Reader r b
transformers Control.Monad.Trans.Reader, mtl Control.Monad.Reader
Transform the value returned by a Reader. *  (mapReader f m) = f . > runReader
mapReaderT :: (m a -> n b) -> ReaderT r m a -> ReaderT r n b
transformers Control.Monad.Trans.Reader, mtl Control.Monad.Reader
Transform the computation inside a ReaderT. *  (mapReaderT f m) = f . > runReaderT
mapResult :: Testable prop => (Result -> Result) -> prop -> Property
QuickCheck Test.QuickCheck.Property
mapRoseResult :: Testable prop => (Rose Result -> Rose Result) -> prop -> Property
QuickCheck Test.QuickCheck.Property
mapRWS :: ((a, s, w) -> (b, s, w')) -> RWS r w s a -> RWS r w' s b
transformers Control.Monad.Trans.RWS.Lazy, transformers Control.Monad.Trans.RWS.Strict, mtl Control.Monad.RWS.Lazy, mtl Control.Monad.RWS.Strict
Map the return value, final state and output of a computation using the given function. *  (mapRWS f m) r s = f (runRWS m r >  

Show more results