stable-maps-0.0.5: Heterogeneous maps keyed by StableNames

Safe HaskellUnsafe




data Map a Source

insertWith :: (a -> a -> a) -> DynamicStableName -> a -> Map a -> Map aSource

O(log n). Insert with a function for combining the new value and old value. insertWith f key value mp will insert the pair (key, value) into mp if the key does not exist in the map. If the key does exist, the function will insert the pair (key, f new_value old_value)

insertWith' :: (a -> a -> a) -> DynamicStableName -> a -> Map a -> Map aSource

Same as insertWith, but with the combining function applied strictly.

lookup :: DynamicStableName -> Map v -> Maybe vSource

O(log n). Lookup the value at a key in the map.

The function will return the corresponding value as a (Just value) or Nothing if the key isn't in the map.

findWithDefault :: v -> DynamicStableName -> Map v -> vSource

O(log n). The expression (findWithDefault def k map) returns the value at key k or returns the default value def when the key is not in the map.