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.
mapPrimArray :: (Prim a, Prim b) => (a -> b) -> PrimArray a -> PrimArray bprimitive Data.Primitive.PrimArray Map over the elements of a primitive array.
mapSmallArray' :: (a -> b) -> SmallArray a -> SmallArray bprimitive Data.Primitive.SmallArray Strict map over the elements of the array.
mappedException :: (Exception e, Exception e') => Setter s s e e'lens Control.Exception.Lens This Setter can be used to purely map over the Exceptions an arbitrary expression might throw; it is a variant of mapException in the same way that mapped is a variant of fmap.
'mapException' ≡ 'over' 'mappedException'
This view that every Haskell expression can be regarded as carrying a bag of Exceptions is detailed in “A Semantics for Imprecise Exceptions” by Peyton Jones & al. at PLDI ’99. The following maps failed assertions to arithmetic overflow:>>> handling _Overflow (\_ -> return "caught") $ assert False (return "uncaught") & mappedException %~ \ (AssertionFailed _) -> Overflow "caught"
mappedException' :: Exception e' => Setter s s SomeException e'lens Control.Exception.Lens This is a type restricted version of mappedException, which avoids the type ambiguity in the input Exception when using set. The following maps any exception to arithmetic overflow:
>>> handling _Overflow (\_ -> return "caught") $ assert False (return "uncaught") & mappedException' .~ Overflow "caught"
mapAccumLOf :: LensLike (State acc) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)lens Control.Lens.Combinators This generalizes mapAccumL to an arbitrary Traversal.
mapAccumL ≡ mapAccumLOf traverse
mapAccumLOf accumulates State from left to right.mapAccumLOf :: Iso s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t) mapAccumLOf :: Lens s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t) mapAccumLOf :: Traversal s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)
mapAccumLOf :: LensLike (State acc) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t) mapAccumLOf l f acc0 s = swap (runState (l (a -> state (acc -> swap (f acc a))) s) acc0)
-
lens Control.Lens.Combinators This generalizes mapAccumR to an arbitrary Traversal.
mapAccumR ≡ mapAccumROf traverse
mapAccumROf accumulates State from right to left.mapAccumROf :: Iso s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t) mapAccumROf :: Lens s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t) mapAccumROf :: Traversal s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)
mapAccumROf :: LensLike (Backwards (State acc)) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)
mapEq :: forall k1 k2 (s :: k1) (t :: k2) (a :: k1) (b :: k2) f . AnEquality s t a b -> f s -> f alens Control.Lens.Combinators We can use Equality to do substitution into anything.
mapMOf :: LensLike (WrappedMonad m) s t a b -> (a -> m b) -> s -> m tlens Control.Lens.Combinators Map each element of a structure targeted by a Lens to a monadic action, evaluate these actions from left to right, and collect the results.
>>> mapMOf both (\x -> [x, x + 1]) (1,3) [(1,3),(1,4),(2,3),(2,4)]
mapM ≡ mapMOf traverse imapMOf l ≡ forM l . Indexed
mapMOf :: Monad m => Iso s t a b -> (a -> m b) -> s -> m t mapMOf :: Monad m => Lens s t a b -> (a -> m b) -> s -> m t mapMOf :: Monad m => Traversal s t a b -> (a -> m b) -> s -> m t
mapMOf_ :: Monad m => Getting (Sequenced r m) s a -> (a -> m r) -> s -> m ()lens Control.Lens.Combinators Map each target of a Fold on a structure to a monadic action, evaluate these actions from left to right, and ignore the results.
>>> mapMOf_ both putStrLn ("hello","world") hello worldmapM_ ≡ mapMOf_ folded
mapMOf_ :: Monad m => Getter s a -> (a -> m r) -> s -> m () mapMOf_ :: Monad m => Fold s a -> (a -> m r) -> s -> m () mapMOf_ :: Monad m => Lens' s a -> (a -> m r) -> s -> m () mapMOf_ :: Monad m => Iso' s a -> (a -> m r) -> s -> m () mapMOf_ :: Monad m => Traversal' s a -> (a -> m r) -> s -> m () mapMOf_ :: Monad m => Prism' s a -> (a -> m r) -> s -> m ()
mapOf :: ASetter s t a b -> (a -> b) -> s -> tlens Control.Lens.Combinators Deprecated: Use over