liquid-fixpoint-0.9.6.3: Predicate Abstraction-based Horn-Clause/Implication Constraint Solver
Safe HaskellSafe-Inferred
LanguageHaskell98

Data.ShareMap

Synopsis

Documentation

data ShareMap k v Source #

A HashMap that can share the values of some entries

If two keys k1 and k2 are mapped to single v, updating the entry for k1 also updates the entry for k2 and viceversa.

The user of the map is responsible for indicating which keys are going to share their values.

Keys can be updated with shareMapInsertWith and mergeKeysWith.

Instances

Instances details
(Show k, Show v) => Show (ShareMap k v) Source # 
Instance details

Defined in Data.ShareMap

Methods

showsPrec :: Int -> ShareMap k v -> ShowS #

show :: ShareMap k v -> String #

showList :: [ShareMap k v] -> ShowS #

toHashMap :: (Hashable k, Eq k) => ShareMap k v -> HashMap k v Source #

insertWith :: (Hashable k, Eq k) => (v -> v -> v) -> k -> v -> ShareMap k v -> ShareMap k v Source #

insertWith f k v m is the map m plus key k being associated to value v.

If k is present in m, then k and any other key sharing its value will be associated to f v (m ! k).

map :: (a -> b) -> ShareMap k a -> ShareMap k b Source #

mergeKeysWith :: (Hashable k, Eq k) => (v -> v -> v) -> k -> k -> ShareMap k v -> ShareMap k v Source #

mergeKeysWith f k0 k1 m updates the k0 value to f (m ! k0) (m ! k1) and k1 shares the value with k0.

If k0 and k1 are already sharing their values in m, or both keys are missing, this operation returns m unmodified.

If only one of the keys is present, the other key is associated with the existing value.