Hoogle Search

Within LTS Haskell 24.65 (ghc-9.10.3)

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

  1. paramSpecPoolLookup :: (HasCallStack, MonadIO m) => ParamSpecPool -> Text -> GType -> Bool -> m (Maybe GParamSpec)

    gi-gobject GI.GObject.Structs.ParamSpecPool

    Looks up a ParamSpec in the pool.

  2. insertLookupWithKey :: IsMap map => (ContainerKey map -> MapValue map -> MapValue map -> MapValue map) -> ContainerKey map -> MapValue map -> map -> (Maybe (MapValue map), map)

    mono-traversable Data.Containers

    Insert a key-value pair into a map, return the previous key's value if it existed. Inserts the value directly if the key does not exist in the map. Otherwise, apply a supplied function that accepts the key, the new value, and the previous value and insert that result into the map.

  3. updateLookupWithKey :: IsMap map => (ContainerKey map -> MapValue map -> Maybe (MapValue map)) -> ContainerKey map -> map -> (Maybe (MapValue map), map)

    mono-traversable Data.Containers

    Apply a function to the value of a given key. If the map does not contain the key this returns Nothing and the input map. If the map does contain the key but the function returns Nothing, this returns the previous value and the map with the key-value pair removed. If the map contains the key and the function returns a value, this returns the new value and the map with the key-value pair with the new value.

  4. insertLookupWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> (Maybe a, Map k a)

    rio RIO.Map

    Combines insert operation with old value retrieval. The expression (insertLookupWithKey f k x map) is a pair where the first element is equal to (lookup k map) and the second element equal to (insertWithKey f k x map).

    let f key new_value old_value = (show key) ++ ":" ++ new_value ++ "|" ++ old_value
    insertLookupWithKey f 5 "xxx" (fromList [(5,"a"), (3,"b")]) == (Just "a", fromList [(3, "b"), (5, "5:xxx|a")])
    insertLookupWithKey f 7 "xxx" (fromList [(5,"a"), (3,"b")]) == (Nothing,  fromList [(3, "b"), (5, "a"), (7, "xxx")])
    insertLookupWithKey f 5 "xxx" empty                         == (Nothing,  singleton 5 "xxx")
    
    This is how to define insertLookup using insertLookupWithKey:
    let insertLookup kx x t = insertLookupWithKey (\_ a _ -> a) kx x t
    insertLookup 5 "x" (fromList [(5,"a"), (3,"b")]) == (Just "a", fromList [(3, "b"), (5, "x")])
    insertLookup 7 "x" (fromList [(5,"a"), (3,"b")]) == (Nothing,  fromList [(3, "b"), (5, "a"), (7, "x")])
    
    Also see the performance note on fromListWith.

  5. splitLookup :: Ord k => k -> Map k a -> (Map k a, Maybe a, Map k a)

    rio RIO.Map

    The expression (splitLookup k map) splits a map just like split but also returns lookup k map.

    splitLookup 2 (fromList [(5,"a"), (3,"b")]) == (empty, Nothing, fromList [(3,"b"), (5,"a")])
    splitLookup 3 (fromList [(5,"a"), (3,"b")]) == (empty, Just "b", singleton 5 "a")
    splitLookup 4 (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", Nothing, singleton 5 "a")
    splitLookup 5 (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", Just "a", empty)
    splitLookup 6 (fromList [(5,"a"), (3,"b")]) == (fromList [(3,"b"), (5,"a")], Nothing, empty)
    

  6. updateLookupWithKey :: Ord k => (k -> a -> Maybe a) -> k -> Map k a -> (Maybe a, Map k a)

    rio RIO.Map

    Lookup and update. See also updateWithKey. The function returns changed value, if it is updated. Returns the original key value if the map entry is deleted.

    let f k x = if x == "a" then Just ((show k) ++ ":new a") else Nothing
    updateLookupWithKey f 5 (fromList [(5,"a"), (3,"b")]) == (Just "5:new a", fromList [(3, "b"), (5, "5:new a")])
    updateLookupWithKey f 7 (fromList [(5,"a"), (3,"b")]) == (Nothing,  fromList [(3, "b"), (5, "a")])
    updateLookupWithKey f 3 (fromList [(5,"a"), (3,"b")]) == (Just "b", singleton 5 "a")
    

  7. defaultMimeLookup :: FileName -> MimeType

    mime-types Network.Mime

    mimeByExt applied to defaultMimeType and defaultMimeMap.

  8. deleteLookup :: IsNode a => Key a -> Graph a -> (Maybe a, Graph a)

    Cabal-syntax Distribution.Compat.Graph

    O(log V). Lookup and delete. This function returns the deleted value if it existed.

  9. insMapLookupNode :: (Ord a, DynGraph g) => NodeMap a -> a -> g a b -> (Bool, g a b, NodeMap a, LNode a)

    fgl Data.Graph.Inductive.NodeMap

    Act as insMapNode, but return also a boolean set as True if the node was already in the map.

  10. mkLookupNode :: Ord a => NodeMap a -> a -> (Bool, LNode a, NodeMap a)

    fgl Data.Graph.Inductive.NodeMap

    Act as mkNode, but return also a boolean set as True if the node was already in the map.

Page 190 of many | Previous | Next