Hoogle Search
Within LTS Haskell 24.35 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
foldMapWithKey :: Monoid m => (k -> a -> m) -> Map k a -> mrio RIO.Map Fold the keys and values in the map using the given monoid, such that
foldMapWithKey f = fold . mapWithKey f
This can be an asymptotically faster than foldrWithKey or foldlWithKey for some monoids.isProperSubmapOf :: (Ord k, Eq a) => Map k a -> Map k a -> Boolrio RIO.Map Is this a proper submap? (ie. a submap but not equal). Defined as (isProperSubmapOf = isProperSubmapOfBy (==)).
isProperSubmapOfBy :: Ord k => (a -> b -> Bool) -> Map k a -> Map k b -> Boolrio RIO.Map Is this a proper submap? (ie. a submap but not equal). The expression (isProperSubmapOfBy f m1 m2) returns True when keys m1 and keys m2 are not equal, all keys in m1 are in m2, and when f returns True when applied to their respective values. For example, the following expressions are all True:
isProperSubmapOfBy (==) (fromList [(1,1)]) (fromList [(1,1),(2,2)]) isProperSubmapOfBy (<=) (fromList [(1,1)]) (fromList [(1,1),(2,2)])
But the following are all False:isProperSubmapOfBy (==) (fromList [(1,1),(2,2)]) (fromList [(1,1),(2,2)]) isProperSubmapOfBy (==) (fromList [(1,1),(2,2)]) (fromList [(1,1)]) isProperSubmapOfBy (<) (fromList [(1,1)]) (fromList [(1,1),(2,2)])
isSubmapOf :: (Ord k, Eq a) => Map k a -> Map k a -> Boolrio RIO.Map This function is defined as (isSubmapOf = isSubmapOfBy (==)).
isSubmapOfBy :: Ord k => (a -> b -> Bool) -> Map k a -> Map k b -> Boolrio RIO.Map The expression (isSubmapOfBy f t1 t2) returns True if all keys in t1 are in tree t2, and when f returns True when applied to their respective values. For example, the following expressions are all True:
isSubmapOfBy (==) (fromList [('a',1)]) (fromList [('a',1),('b',2)]) isSubmapOfBy (<=) (fromList [('a',1)]) (fromList [('a',1),('b',2)]) isSubmapOfBy (==) (fromList [('a',1),('b',2)]) (fromList [('a',1),('b',2)])But the following are all False:isSubmapOfBy (==) (fromList [('a',2)]) (fromList [('a',1),('b',2)]) isSubmapOfBy (<) (fromList [('a',1)]) (fromList [('a',1),('b',2)]) isSubmapOfBy (==) (fromList [('a',1),('b',2)]) (fromList [('a',1)])Note that isSubmapOfBy (_ _ -> True) m1 m2 tests whether all the keys in m1 are also keys in m2.biconcatMap :: Bifoldable t => (a -> [c]) -> (b -> [c]) -> t a b -> [c]rio RIO.Prelude Given a means of mapping the elements of a structure to lists, computes the concatenation of all such lists in order.
Examples
Basic usage:>>> biconcatMap (take 3) (fmap digitToInt) ([1..], "89") [1,2,3,8,9]
>>> biconcatMap (take 3) (fmap digitToInt) (Left [1..]) [1,2,3]
>>> biconcatMap (take 3) (fmap digitToInt) (Right "89") [8,9]
bifoldMap :: (Bifoldable p, Monoid m) => (a -> m) -> (b -> m) -> p a b -> mrio RIO.Prelude Combines the elements of a structure, given ways of mapping them to a common monoid.
bifoldMap f g ≡ bifoldr (mappend . f) (mappend . g) mempty
Examples
Basic usage:>>> bifoldMap (take 3) (fmap digitToInt) ([1..], "89") [1,2,3,8,9]
>>> bifoldMap (take 3) (fmap digitToInt) (Left [1..]) [1,2,3]
>>> bifoldMap (take 3) (fmap digitToInt) (Right "89") [8,9]
bimap :: Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b drio RIO.Prelude Map over both arguments at the same time.
bimap f g ≡ first f . second g
Examples
>>> bimap toUpper (+1) ('j', 3) ('J',4)>>> bimap toUpper (+1) (Left 'j') Left 'J'
>>> bimap toUpper (+1) (Right 3) Right 4
-
rio RIO.Prelude The bimapAccumL function behaves like a combination of bimap and bifoldl; it traverses a structure from left to right, threading a state of type a and using the given actions to compute new elements for the structure.
Examples
Basic usage:>>> bimapAccumL (\acc bool -> (acc + 1, show bool)) (\acc string -> (acc * 2, reverse string)) 3 (True, "foo") (8,("True","oof")) -
rio RIO.Prelude The bimapAccumR function behaves like a combination of bimap and bifoldr; it traverses a structure from right to left, threading a state of type a and using the given actions to compute new elements for the structure.
Examples
Basic usage:>>> bimapAccumR (\acc bool -> (acc + 1, show bool)) (\acc string -> (acc * 2, reverse string)) 3 (True, "foo") (7,("True","oof"))