Hoogle Search
Within LTS Haskell 24.34 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
mapTup3M_ :: Applicative m => (a -> m b) -> (a, a, a) -> m ()tools-yj Data.Tuple.ToolsYj No documentation available.
mapWithKey :: ([c] -> a -> b) -> TMap c a -> TMap c btrie-simple Data.Trie.Map Same semantics to following defintion, but have more efficient implementation.
mapWithKey f = fromAscList . map (\(cs,a) -> (cs, f cs a)) . toAscList
mapPolyT :: MapT (Poly a b) s t => (a -> b) -> s -> ttuple-sop Data.Tuple.Ops Applies a polymorphic function to each element in an n-ary tuple. Requires all elements in the tuple to be of the same type.
>>> mapPolyT (+1) (5,6,7,8) (6,7,8,9)
>>> mapPolyT (+1) (5,6,7,False) No instance for (Num Bool) arising from the literal `5'
mapT :: MapT f s t => f -> s -> ttuple-sop Data.Tuple.Ops Maps a monomorphic function over each element in an n-ary tuple that matches the type of the argument of the function
>>> mapT not (True,'c',False) (False,'c',True)
Sometimes it is necessary to specify the result type.>>> mapT (+1) (5,6,7,False) :: (Integer,Integer,Integer,Bool) (6,7,8,False)
Using mapPolyT this is not necessary. However, to use mapPolyT the tuple may only contains elements of a single type.mapM :: (Monad m, Unboxable a, Unboxable b) => (a -> m b) -> Vector a -> m (Vector b)unboxing-vector Data.Vector.Unboxing No documentation available.
mapM_ :: (Monad m, Unboxable a) => (a -> m b) -> Vector a -> m ()unboxing-vector Data.Vector.Unboxing No documentation available.
mapMaybe :: (Unboxable a, Unboxable b) => (a -> Maybe b) -> Vector a -> Vector bunboxing-vector Data.Vector.Unboxing No documentation available.
mapOf :: Typeable x => UnjsonDef x -> UnjsonDef (LazyKeyMap x)unjson Data.Unjson Gather all keys with respective values in a map. Example:
data X = X { xMap :: LazyHashMap.HashMap Text.Text x } objectOf $ pure X <*> fieldBy "xmap" xMap "Map string to Y value" (mapOf unjsonY)Note that overloading allows for automatic conversion to more map types, for example:data X = X { xMap :: Map.Map String x } objectOf $ pure X <*> field "xmap" xMap "Map string to Y value"-
vary Vary Run a function on one of the variant's possibilities, keeping all other possibilities the same. This is the generalization of functions like Either's mapLeft and mapRight. If you want to map a polymorphic function like show which could match more than one possibility, use a TypeApplication to specify the desired possibility to match:
>>> :{ (Vary.from @Int 42 :: Vary [Int, Bool] ) & Vary.mapOn @Bool show -- Vary [Int, String] & Vary.mapOn @Int show -- Vary [String, String] :} Vary.from @[Char] "42"If you end up with a variant with multiple duplicate possibilities, use morph to join them:>>> :{ (Vary.from True :: Vary [Char, Int, Bool]) & Vary.mapOn @Bool show -- Vary [Char, Int, String] & Vary.mapOn @Int show -- Vary [Char, String, String] & Vary.mapOn @Char show -- Vary [String, String, String] & Vary.morph @'[String] -- Vary '[String] & Vary.intoOnly -- String :} "True" -
vary Vary.VEither Map a function over the VEither if it contains a VLeft, otherwise leave it alone. See also VEither.mapLeftOn, VEither.mapRight and VEither.veither.