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.
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.
-
vary Vary.VEither Map a function over one of the error values inside the VEither. Any other VLeft and also VRight are kept untouched. Similar to Vary.mapOn.
mapRight :: forall x y (errs :: [Type]) . (x -> y) -> VEither errs x -> VEither errs yvary Vary.VEither Map a function over the VEither if it contains a VRight, otherwise leave it alone. Exists for symmetry with VEither.mapLeft and VEither.mapLeftOn. Indeed, it is just another name for fmap. See also VEither.veither.