Hoogle Search
Within LTS Haskell 24.6 (ghc-9.10.2)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
mapSTLazy :: (Storable a, Storable b) => (a -> ST s b) -> Vector a -> ST s (Vector b)storablevector Data.StorableVector.ST.Strict *Data.StorableVector.ST.Strict Data.STRef> VL.unpack $ Control.Monad.ST.runST (do ref <- newSTRef 'a'; mapSTLazy (\ _n -> do c <- readSTRef ref; modifySTRef ref succ; return c) (VL.pack VL.defaultChunkSize [1,2,3,4::Data.Int.Int16])) "abcd"
The following should not work on infinite streams, since we are in ST with strict >>=. But it works. Why?*Data.StorableVector.ST.Strict Data.STRef> VL.unpack $ Control.Monad.ST.runST (do ref <- newSTRef 'a'; mapSTLazy (\ _n -> do c <- readSTRef ref; modifySTRef ref succ; return c) (VL.pack VL.defaultChunkSize [0::Data.Int.Int16 ..])) "Interrupted.
mapLoc :: SameSpace a b => (a -> b) -> Located a -> Located bdiagrams-lib Diagrams.Located Located is not a Functor, since changing the type could change the type of the associated vector space, in which case the associated location would no longer have the right type. mapLoc has an extra constraint specifying that the vector space must stay the same. (Technically, one can say that for every vector space v, Located is a little-f (endo)functor on the category of types with associated vector space v; but that is not covered by the standard Functor class.)
mapAccumLOf :: LensLike (State acc) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)diagrams-lib Diagrams.Prelude 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)
-
diagrams-lib Diagrams.Prelude 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 adiagrams-lib Diagrams.Prelude We can use Equality to do substitution into anything.
mapMOf :: LensLike (WrappedMonad m) s t a b -> (a -> m b) -> s -> m tdiagrams-lib Diagrams.Prelude 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 ()diagrams-lib Diagrams.Prelude 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 world
mapM_ ≡ 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 -> tdiagrams-lib Diagrams.Prelude mapped :: forall (f :: Type -> Type) a b . Functor f => Setter (f a) (f b) a bdiagrams-lib Diagrams.Prelude This Setter can be used to map over all of the values in a Functor.
fmap ≡ over mapped fmapDefault ≡ over traverse (<$) ≡ set mapped
>>> over mapped f [a,b,c] [f a,f b,f c]
>>> over mapped (+1) [1,2,3] [2,3,4]
>>> set mapped x [a,b,c] [x,x,x]
>>> [[a,b],[c]] & mapped.mapped +~ x [[a + x,b + x],[c + x]]
>>> over (mapped._2) length [("hello","world"),("leaders","!!!")] [("hello",5),("leaders",3)]
mapped :: Functor f => Setter (f a) (f b) a b
If you want an IndexPreservingSetter use setting fmap.-
diagrams-lib Diagrams.Prelude