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.

  1. mapWithKey :: (Key -> a -> b) -> IntMap a -> IntMap b

    containers Data.IntMap.Strict.Internal

    Map a function over all values in the map.

    let f key x = (show key) ++ ":" ++ x
    mapWithKey f (fromList [(5,"a"), (3,"b")]) == fromList [(3, "3:b"), (5, "5:a")]
    

  2. mapMonotonic :: (Key -> Key) -> IntSet -> IntSet

    containers Data.IntSet

    The mapMonotonic f s == map f s, but works only when f is strictly increasing. The precondition is not checked. Semi-formally, we have:

    and [x < y ==> f x < f y | x <- ls, y <- ls]
    ==> mapMonotonic f s == map f s
    where ls = toList s
    

  3. mapMonotonic :: (Key -> Key) -> IntSet -> IntSet

    containers Data.IntSet.Internal

    The mapMonotonic f s == map f s, but works only when f is strictly increasing. The precondition is not checked. Semi-formally, we have:

    and [x < y ==> f x < f y | x <- ls, y <- ls]
    ==> mapMonotonic f s == map f s
    where ls = toList s
    

  4. mapAccum :: (a -> b -> (a, c)) -> a -> Map k b -> (a, Map k c)

    containers Data.Map.Internal

    The function mapAccum threads an accumulating argument through the map in ascending order of keys.

    let f a b = (a ++ b, b ++ "X")
    mapAccum f "Everything: " (fromList [(5,"a"), (3,"b")]) == ("Everything: ba", fromList [(3, "bX"), (5, "aX")])
    

  5. mapAccumRWithKey :: (a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c)

    containers Data.Map.Internal

    The function mapAccumRWithKey threads an accumulating argument through the map in descending order of keys.

  6. mapAccumWithKey :: (a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c)

    containers Data.Map.Internal

    The function mapAccumWithKey threads an accumulating argument through the map in ascending order of keys.

    let f a k b = (a ++ " " ++ (show k) ++ "-" ++ b, b ++ "X")
    mapAccumWithKey f "Everything:" (fromList [(5,"a"), (3,"b")]) == ("Everything: 3-b 5-a", fromList [(3, "bX"), (5, "aX")])
    

  7. mapEither :: (a -> Either b c) -> Map k a -> (Map k b, Map k c)

    containers Data.Map.Internal

    Map values and separate the Left and Right results.

    let f a = if a < "c" then Left a else Right a
    mapEither f (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")])
    == (fromList [(3,"b"), (5,"a")], fromList [(1,"x"), (7,"z")])
    
    mapEither (\ a -> Right a) (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")])
    == (empty, fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")])
    

  8. mapEitherWithKey :: (k -> a -> Either b c) -> Map k a -> (Map k b, Map k c)

    containers Data.Map.Internal

    Map keys/values and separate the Left and Right results.

    let f k a = if k < 5 then Left (k * 2) else Right (a ++ a)
    mapEitherWithKey f (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")])
    == (fromList [(1,2), (3,6)], fromList [(5,"aa"), (7,"zz")])
    
    mapEitherWithKey (\_ a -> Right a) (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")])
    == (empty, fromList [(1,"x"), (3,"b"), (5,"a"), (7,"z")])
    

  9. mapGentlyWhenMatched :: forall (f :: Type -> Type) a b k x y . Functor f => (a -> b) -> WhenMatched f k x y a -> WhenMatched f k x y b

    containers Data.Map.Internal

    Map covariantly over a WhenMatched f k x, using only a 'Functor f' constraint.

  10. mapGentlyWhenMissing :: forall (f :: Type -> Type) a b k x . Functor f => (a -> b) -> WhenMissing f k x a -> WhenMissing f k x b

    containers Data.Map.Internal

    Map covariantly over a WhenMissing f k x, using only a 'Functor f' constraint.

Page 57 of many | Previous | Next