Hoogle Search

Within LTS Haskell 24.51 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. adjustWithKey :: (Key -> a -> a) -> Key -> NEIntMap a -> NEIntMap a

    nonempty-containers Data.IntMap.NonEmpty

    O(log n). Adjust a value at a specific key. When the key is not a member of the map, the original map is returned.

    let f key x = (show key) ++ ":new " ++ x
    adjustWithKey f 5 (fromList ((5,"a") :| [(3,"b")])) == fromList ((3, "b") :| [(5, "5:new a")])
    adjustWithKey f 7 (fromList ((5,"a") :| [(3,"b")])) == fromList ((3, "b") :| [(5, "a")])
    

  2. adjust :: Ord k => (a -> a) -> k -> NEMap k a -> NEMap k a

    nonempty-containers Data.Map.NonEmpty

    O(log n). Update a value at a specific key with the result of the provided function. When the key is not a member of the map, the original map is returned.

    adjust ("new " ++) 5 (fromList ((5,"a") :| [(3,"b")])) == fromList ((3, "b") :| [(5, "new a")])
    adjust ("new " ++) 7 (fromList ((5,"a") :| [(3,"b")])) == fromList ((3, "b") :| [(5, "a")])
    

  3. adjustAt :: (k -> a -> a) -> Int -> NEMap k a -> NEMap k a

    nonempty-containers Data.Map.NonEmpty

    O(log n). Variant of updateAt that disallows deletion. Allows us to guarantee that the result is also a non-empty Map.

  4. adjustMax :: (a -> a) -> NEMap k a -> NEMap k a

    nonempty-containers Data.Map.NonEmpty

    O(log n). A version of updateMax that disallows deletion, allowing us to guarantee that the result is also non-empty.

  5. adjustMaxWithKey :: (k -> a -> a) -> NEMap k a -> NEMap k a

    nonempty-containers Data.Map.NonEmpty

    O(log n). A version of updateMaxWithKey that disallows deletion, allowing us to guarantee that the result is also non-empty.

  6. adjustMin :: (a -> a) -> NEMap k a -> NEMap k a

    nonempty-containers Data.Map.NonEmpty

    O(1). A version of updateMin that disallows deletion, allowing us to guarantee that the result is also non-empty.

  7. adjustMinWithKey :: (k -> a -> a) -> NEMap k a -> NEMap k a

    nonempty-containers Data.Map.NonEmpty

    O(1). A version of adjustMaxWithKey that disallows deletion, allowing us to guarantee that the result is also non-empty. Note that it also is able to have better asymptotics than updateMinWithKey in general.

  8. adjustWithKey :: Ord k => (k -> a -> a) -> k -> NEMap k a -> NEMap k a

    nonempty-containers Data.Map.NonEmpty

    O(log n). Adjust a value at a specific key. When the key is not a member of the map, the original map is returned.

    let f key x = (show key) ++ ":new " ++ x
    adjustWithKey f 5 (fromList ((5,"a") :| [(3,"b")])) == fromList ((3, "b") :| [(5, "5:new a")])
    adjustWithKey f 7 (fromList ((5,"a") :| [(3,"b")])) == fromList ((3, "b") :| [(5, "a")])
    

  9. adjust :: (a -> a) -> Int -> NESeq a -> NESeq a

    nonempty-containers Data.Sequence.NonEmpty

    Update the element at the specified position. If the position is out of range, the original sequence is returned. adjust can lead to poor performance and even memory leaks, because it does not force the new value before installing it in the sequence. adjust' should usually be preferred.

  10. adjust' :: (a -> a) -> Int -> NESeq a -> NESeq a

    nonempty-containers Data.Sequence.NonEmpty

    Update the element at the specified position. If the position is out of range, the original sequence is returned. The new value is forced before it is installed in the sequence.

    adjust' f i xs =
    case xs !? i of
    Nothing -> xs
    Just x -> let !x' = f x
    in update i x' xs
    

Page 64 of many | Previous | Next